Class: Nucleo::Models::MetricPeriodsTotals
- Inherits:
-
Object
- Object
- Nucleo::Models::MetricPeriodsTotals
- Defined in:
- lib/nucleo/models/metric_periods_totals.rb
Instance Method Summary collapse
-
#current_period ⇒ Nucleo::Models::MetricPeriodTotals
Returns the current period totals.
-
#dimension ⇒ String
Returns the dimension.
-
#initialize(attributes = {}) ⇒ Nucleo::Models::MetricPeriodsTotals
constructor
Returns an instance of the MetricPeriodsTotals domain model.
-
#metric ⇒ String
Returns the metric type for the totals.
-
#prior_period ⇒ Nucleo::Models::MetricPeriodTotals
(also: #previous_period)
Returns the prior period totals.
Constructor Details
#initialize(attributes = {}) ⇒ Nucleo::Models::MetricPeriodsTotals
Returns an instance of the MetricPeriodsTotals domain model
These are the totals across both ‘current_period` and `prior_period`.
12 13 14 |
# File 'lib/nucleo/models/metric_periods_totals.rb', line 12 def initialize(attributes={}) @attributes = attributes end |
Instance Method Details
#current_period ⇒ Nucleo::Models::MetricPeriodTotals
Returns the current period totals
33 34 35 36 37 38 39 40 41 |
# File 'lib/nucleo/models/metric_periods_totals.rb', line 33 def current_period params = { 'metric' => self.metric, 'dimension' => self.dimension, 'period' => @attributes['totals']['current_period'] } Nucleo::Models::MetricPeriodTotals.new(params) end |
#dimension ⇒ String
Returns the dimension
26 27 28 |
# File 'lib/nucleo/models/metric_periods_totals.rb', line 26 def dimension @attributes['dimension'] end |
#metric ⇒ String
Returns the metric type for the totals
19 20 21 |
# File 'lib/nucleo/models/metric_periods_totals.rb', line 19 def metric @attributes['metric'] end |
#prior_period ⇒ Nucleo::Models::MetricPeriodTotals Also known as: previous_period
Returns the prior period totals
46 47 48 49 50 51 52 53 54 |
# File 'lib/nucleo/models/metric_periods_totals.rb', line 46 def prior_period params = { 'metric' => self.metric, 'dimension' => self.dimension, 'period' => @attributes['totals']['prior_period'] } Nucleo::Models::MetricPeriodTotals.new(params) end |