Class: Nucleo::Models::PageMetric

Inherits:
Object
  • Object
show all
Defined in:
lib/nucleo/models/page_metric.rb

Constant Summary collapse

METRIC_NAME =
'ga:pageviews'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Nucleo::Models::PageRank

Returns an instance of the PageRank domain model

Parameters:

  • attributes (Hash) (defaults to: {})


11
12
13
# File 'lib/nucleo/models/page_metric.rb', line 11

def initialize(attributes={})
  @attributes = attributes
end

Instance Method Details

#changeInteger

Returns the change

Returns:

  • (Integer)


25
26
27
# File 'lib/nucleo/models/page_metric.rb', line 25

def change
  @attributes[translated_key_name(:change)].to_f
end

#pct_totalInteger

Returns the pct total

Returns:

  • (Integer)


32
33
34
# File 'lib/nucleo/models/page_metric.rb', line 32

def pct_total
  @attributes[translated_key_name(:pct_total)].to_f
end

#rankInteger

Returns the rank

Returns:

  • (Integer)


39
40
41
# File 'lib/nucleo/models/page_metric.rb', line 39

def rank
  @attributes[translated_key_name(:rank)].to_i
end

#rank_changeInteger

Returns the rank

Returns:

  • (Integer)


46
47
48
# File 'lib/nucleo/models/page_metric.rb', line 46

def rank_change
  @attributes[translated_key_name(:rank_change)].to_i
end

#valueInteger

Returns the metric value

Returns:

  • (Integer)


18
19
20
# File 'lib/nucleo/models/page_metric.rb', line 18

def value
  @attributes[METRIC_NAME].to_i
end