class Nucleo::Models::Metric

Public Class Methods

new(attributes={}) click to toggle source

Returns an instance of the Metric domain model. This is the core domain model for a specific metric `type` and `classification`.

@param attributes [Hash]

@return [Nucleo::Models::Metric]

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

Public Instance Methods

classification() click to toggle source

Returns the classification of the metric

@return [String]

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

Returns the dimension

@return [String]

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

Returns the type of the metric

@return [String]

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

Returns the metric periods used for comparison

@return [Nucleo::Models::MetricPeriods]

# File lib/nucleo/models/metric.rb, line 41
def metric_periods
  params = {
    'metric'         => self.metric,
    'dimension'      => self.dimension,
    'totals'         => @attributes['totals'],
    'current_period' => @attributes['current_period'],
    'prior_period'   => @attributes['prior_period']
  }

  Nucleo::Models::MetricPeriods.new(params)
end