Class: Bitly::API::Bitlink::ClicksSummary

Inherits:
Object
  • Object
show all
Includes:
Bitly::API::Base
Defined in:
lib/bitly/api/bitlink/clicks_summary.rb

Instance Attribute Summary

Attributes included from Bitly::API::Base

#response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Bitly::API::Base

#assign_attributes

Constructor Details

#initialize(data:, response: nil) ⇒ ClicksSummary

Returns a new instance of ClicksSummary.



30
31
32
33
# File 'lib/bitly/api/bitlink/clicks_summary.rb', line 30

def initialize(data:, response: nil)
  assign_attributes(data)
  @response = response
end

Class Method Details

.attributesObject



25
26
27
# File 'lib/bitly/api/bitlink/clicks_summary.rb', line 25

def self.attributes
  [:units, :unit, :unit_reference, :total_clicks]
end

.fetch(client:, bitlink:, unit: nil, units: nil, unit_reference: nil, size: nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bitly/api/bitlink/clicks_summary.rb', line 11

def self.fetch(client:, bitlink:, unit: nil, units: nil, unit_reference: nil, size: nil)
  bitlink = Utils.normalise_bitlink(bitlink: bitlink)
  response = client.request(
    path: "/bitlinks/#{bitlink}/clicks/summary",
    params: {
      "unit" => unit,
      "units" => units,
      "unit_reference" => unit_reference,
      "size" => size
    }
  )
  new(data: response.body, response: response)
end