Class: MetricsApi::V3::Endpoints::Global
- Inherits:
-
Object
- Object
- MetricsApi::V3::Endpoints::Global
- Includes:
- Helpers
- Defined in:
- app/services/metrics_api/v3/endpoints/global.rb
Overview
Global endpoint. Returns a list of presented DailyMetrics models
Instance Attribute Summary collapse
-
#end_date ⇒ Object
readonly
Returns the value of attribute end_date.
-
#start_date ⇒ Object
readonly
Returns the value of attribute start_date.
Instance Method Summary collapse
-
#call ⇒ Object
TODO: Better way of collecting display_collection names.
-
#initialize(params) ⇒ Global
constructor
All endpoints take in a params hash, this endpoint has no params however.
Methods included from Helpers
Constructor Details
#initialize(params) ⇒ Global
All endpoints take in a params hash, this endpoint has no params however
12 13 14 15 |
# File 'app/services/metrics_api/v3/endpoints/global.rb', line 12 def initialize(params) @start_date = parse_date_param(params[:start_date]) || Time.zone.yesterday @end_date = parse_date_param(params[:end_date]) || Time.zone.today end |
Instance Attribute Details
#end_date ⇒ Object (readonly)
Returns the value of attribute end_date.
9 10 11 |
# File 'app/services/metrics_api/v3/endpoints/global.rb', line 9 def end_date @end_date end |
#start_date ⇒ Object (readonly)
Returns the value of attribute start_date.
9 10 11 |
# File 'app/services/metrics_api/v3/endpoints/global.rb', line 9 def start_date @start_date end |
Instance Method Details
#call ⇒ Object
TODO: Better way of collecting display_collection names
18 19 20 21 22 |
# File 'app/services/metrics_api/v3/endpoints/global.rb', line 18 def call metrics = SupplejackApi::DailyMetrics.created_between(start_date, end_date) metrics.map(&MetricsApi::V3::Presenters::DailyMetric) end |