Class: Bitly::API::Bitlink::LinkClick
- Inherits:
-
Object
- Object
- Bitly::API::Bitlink::LinkClick
- Includes:
- Bitly::API::Base
- Defined in:
- lib/bitly/api/bitlink/link_click.rb
Defined Under Namespace
Classes: List
Instance Attribute Summary
Attributes included from Bitly::API::Base
Class Method Summary collapse
- .attributes ⇒ Object
-
.list(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Bitly::API::Bitlink::LinkClick::List
Get the clicks for a bitlink.
- .time_attributes ⇒ Object
Instance Method Summary collapse
-
#initialize(data:) ⇒ LinkClick
constructor
A new instance of LinkClick.
Methods included from Bitly::API::Base
Constructor Details
#initialize(data:) ⇒ LinkClick
Returns a new instance of LinkClick.
71 72 73 |
# File 'lib/bitly/api/bitlink/link_click.rb', line 71 def initialize(data:) assign_attributes(data) end |
Class Method Details
.attributes ⇒ Object
63 64 65 |
# File 'lib/bitly/api/bitlink/link_click.rb', line 63 def self.attributes [:clicks] end |
.list(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Bitly::API::Bitlink::LinkClick::List
Get the clicks for a bitlink. [‘GET /v4/bitlink/bitlink/clicks`](dev.bitly.com/api-reference/#getClicksForBitlink)
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/bitly/api/bitlink/link_click.rb', line 41 def self.list(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) bitlink = Utils.normalise_bitlink(bitlink: bitlink) response = client.request( path: "/bitlinks/#{bitlink}/clicks", params: { "unit" => unit, "units" => units, "unit_reference" => unit_reference, "size" => size } ) body = response.body items = body["link_clicks"].map { |link_click| new(data: link_click) } Bitly::API::Bitlink::LinkClick::List.new( items: items, response: response, unit: body["unit"], units: body["units"], unit_reference: body["unit_reference"] ) end |
.time_attributes ⇒ Object
66 67 68 |
# File 'lib/bitly/api/bitlink/link_click.rb', line 66 def self.time_attributes [:date] end |