class Nucleo::Models::MetricPeriodsTotals

Public Class Methods

new(attributes={}) click to toggle source

Returns an instance of the MetricPeriodsTotals domain model

These are the totals across both `current_period` and `prior_period`.

@param attributes [Hash]

@return [Nucleo::Models::MetricPeriodsTotals]

# File lib/nucleo/models/metric_periods_totals.rb, line 12
def initialize(attributes={})
  @attributes = attributes
end

Public Instance Methods

current_period() click to toggle source

Returns the current period totals

@return [Nucleo::Models::MetricPeriodTotals]

# 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() click to toggle source

Returns the dimension

@return [String]

# File lib/nucleo/models/metric_periods_totals.rb, line 26
def dimension
  @attributes['dimension']
end
metric() click to toggle source

Returns the metric type for the totals

@return [String]

# File lib/nucleo/models/metric_periods_totals.rb, line 19
def metric
  @attributes['metric']
end
previous_period()
Alias for: prior_period
prior_period() click to toggle source

Returns the prior period totals

@return [Nucleo::Models::MetricPeriodTotals]

# 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
Also aliased as: previous_period