Class: MetricsApi::V3::Presenters::View
- Inherits:
-
Object
- Object
- MetricsApi::V3::Presenters::View
- Defined in:
- app/services/metrics_api/v3/presenters/view.rb
Overview
Presents a SupplejackApi::UsageMetrics
ready to be returned via the API
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(metric) ⇒ View
constructor
A new instance of View.
- #to_json ⇒ Object
Constructor Details
#initialize(metric) ⇒ View
Returns a new instance of View.
7 8 9 |
# File 'app/services/metrics_api/v3/presenters/view.rb', line 7 def initialize(metric) @m = metric end |
Class Method Details
.to_proc ⇒ Object
22 23 24 |
# File 'app/services/metrics_api/v3/presenters/view.rb', line 22 def self.to_proc ->(metric) { new(metric).to_json } end |
Instance Method Details
#to_json ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/metrics_api/v3/presenters/view.rb', line 11 def to_json { id: @m.record_field_value, searches: @m.searches, record_page_views: @m.gets, user_set_views: @m.user_set_views, total_views: @m.total_views, records_added_to_user_sets: @m.records_added_to_user_sets } end |