This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2021-10-14 11:44:59 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Admin::Metrics::Dimension::BaseDimension
|
2021-11-25 04:07:38 -08:00
|
|
|
def self.with_params?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(start_at, end_at, limit, params)
|
2021-10-14 11:44:59 -07:00
|
|
|
@start_at = start_at&.to_datetime
|
|
|
|
@end_at = end_at&.to_datetime
|
|
|
|
@limit = limit&.to_i
|
2021-11-25 04:07:38 -08:00
|
|
|
@params = params
|
2021-10-14 11:44:59 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
def key
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
def data
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.model_name
|
|
|
|
self.class.name
|
|
|
|
end
|
|
|
|
|
|
|
|
def read_attribute_for_serialization(key)
|
|
|
|
send(key) if respond_to?(key)
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def time_period
|
2021-11-25 04:07:38 -08:00
|
|
|
(@start_at..@end_at)
|
|
|
|
end
|
|
|
|
|
|
|
|
def params
|
|
|
|
raise NotImplementedError
|
2021-10-14 11:44:59 -07:00
|
|
|
end
|
|
|
|
end
|