Class: Bitly::API::ClickMetric::List

Inherits:
List
  • Object
show all
Defined in:
lib/bitly/api/click_metric.rb

Instance Attribute Summary collapse

Attributes inherited from List

#response

Instance Method Summary collapse

Methods inherited from List

#each

Constructor Details

#initialize(items:, response:, units:, unit_reference:, unit:, facet:) ⇒ List

Returns a new instance of List.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bitly/api/click_metric.rb', line 14

def initialize(items:, response:, units:, unit_reference:, unit:, facet:)
  super(items: items, response: response)
  @units = units
  # It looks like the API for referrers_by_domain returns the
  # unit_reference in seconds, not a string, like every other endpoint.
  begin
    @unit_reference = Time.parse(unit_reference) if unit_reference
  rescue TypeError
    @unit_reference = Time.at(unit_reference)
  end
  @unit = unit
  @facet = facet
end

Instance Attribute Details

#facetObject (readonly)

Returns the value of attribute facet.



13
14
15
# File 'lib/bitly/api/click_metric.rb', line 13

def facet
  @facet
end

#unitObject (readonly)

Returns the value of attribute unit.



13
14
15
# File 'lib/bitly/api/click_metric.rb', line 13

def unit
  @unit
end

#unit_referenceObject (readonly)

Returns the value of attribute unit_reference.



13
14
15
# File 'lib/bitly/api/click_metric.rb', line 13

def unit_reference
  @unit_reference
end

#unitsObject (readonly)

Returns the value of attribute units.



13
14
15
# File 'lib/bitly/api/click_metric.rb', line 13

def units
  @units
end