Class: MetricsApi::V3::Presenters::DailyMetric

Inherits:
Object
  • Object
show all
Defined in:
app/services/metrics_api/v3/presenters/daily_metric.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(daily_metric) ⇒ DailyMetric

Returns a new instance of DailyMetric.



6
7
8
# File 'app/services/metrics_api/v3/presenters/daily_metric.rb', line 6

def initialize(daily_metric)
  @dm = daily_metric
end

Class Method Details

.to_procObject



17
18
19
# File 'app/services/metrics_api/v3/presenters/daily_metric.rb', line 17

def self.to_proc
  ->(metric) { new(metric).to_json }
end

Instance Method Details

#to_jsonObject



10
11
12
13
14
15
# File 'app/services/metrics_api/v3/presenters/daily_metric.rb', line 10

def to_json
  {
    day: @dm.date,
    total_public_sets: @dm.total_public_sets
  }
end