Class: Bitly::API::ClickMetric
- Inherits:
-
Object
- Object
- Bitly::API::ClickMetric
- Includes:
- Base
- Defined in:
- lib/bitly/api/click_metric.rb
Defined Under Namespace
Instance Attribute Summary
Attributes included from Base
Class Method Summary collapse
- .attributes ⇒ Object
-
.list_countries_by_bitlink(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Bitly::API::ClickMetric::List
Get metrics for a Bitlink by country [‘GET /v4/bitlinks/bitlink/countries`](dev.bitly.com/api-reference/#getMetricsForBitlinkByCountries).
-
.list_countries_by_group(client:, group_guid:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Bitly::API::ClickMetric::List
Gets the country click metrics for the group.
- .list_referrers(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Object
- .list_referrers_by_domain(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Object
- .list_referring_domains(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Object
-
.list_referring_networks(client:, group_guid:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Bitly::API::ClickMetric::List
Gets the referring networks for the group.
Instance Method Summary collapse
-
#initialize(data:) ⇒ ClickMetric
constructor
A new instance of ClickMetric.
Methods included from Base
Constructor Details
#initialize(data:) ⇒ ClickMetric
Returns a new instance of ClickMetric.
176 177 178 |
# File 'lib/bitly/api/click_metric.rb', line 176 def initialize(data:) assign_attributes(data) end |
Class Method Details
.attributes ⇒ Object
171 172 173 |
# File 'lib/bitly/api/click_metric.rb', line 171 def self.attributes [:clicks, :value] end |
.list_countries_by_bitlink(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Bitly::API::ClickMetric::List
Get metrics for a Bitlink by country [‘GET /v4/bitlinks/bitlink/countries`](dev.bitly.com/api-reference/#getMetricsForBitlinkByCountries)
119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/bitly/api/click_metric.rb', line 119 def self.list_countries_by_bitlink(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) bitlink = Bitlink::Utils.normalise_bitlink(bitlink: bitlink) list_metrics( client: client, path: "/bitlinks/#{bitlink}/countries", unit: unit, units: units, unit_reference: unit_reference, size: size ) end |
.list_countries_by_group(client:, group_guid:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Bitly::API::ClickMetric::List
Gets the country click metrics for the group. [‘GET /v4/groups/group_guid/countries`](dev.bitly.com/api-reference/#getGroupMetricsByCountries)
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/bitly/api/click_metric.rb', line 80 def self.list_countries_by_group(client:, group_guid:, unit: nil, units: nil, size: nil, unit_reference: nil) list_metrics( client: client, path: "/groups/#{group_guid}/countries", unit: unit, units: units, unit_reference: unit_reference, size: size ) end |
.list_referrers(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/bitly/api/click_metric.rb', line 91 def self.list_referrers(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) bitlink = Bitlink::Utils.normalise_bitlink(bitlink: bitlink) list_metrics( client: client, path: "/bitlinks/#{bitlink}/referrers", unit: unit, units: units, unit_reference: unit_reference, size: size ) end |
.list_referrers_by_domain(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/bitly/api/click_metric.rb', line 143 def self.list_referrers_by_domain(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) bitlink = Bitlink::Utils.normalise_bitlink(bitlink: bitlink) response = client.request( path: "/bitlinks/#{bitlink}/referrers_by_domains", params: { "unit" => unit, "units" => units, "unit_reference" => unit_reference, "size" => size } ) body = response.body referrers = body["referrers_by_domain"].map do |referrer| click_metrics = referrer["referrers"].map do |metric| ClickMetric.new(data: metric) end Referrers.new(items: click_metrics, response: response, network: referrer["network"]) end List.new( items: referrers, response: response, unit: body["unit"], units: body["units"], unit_reference: body["unit_reference"], facet: body["facet"] ) end |
.list_referring_domains(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/bitly/api/click_metric.rb', line 131 def self.list_referring_domains(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil) bitlink = Bitlink::Utils.normalise_bitlink(bitlink: bitlink) list_metrics( client: client, path: "/bitlinks/#{bitlink}/referring_domains", unit: unit, units: units, unit_reference: unit_reference, size: size ) end |
.list_referring_networks(client:, group_guid:, unit: nil, units: nil, size: nil, unit_reference: nil) ⇒ Bitly::API::ClickMetric::List
Gets the referring networks for the group. [‘GET /v4/groups/group_guid/referring_networks`](dev.bitly.com/api-reference/#GetGroupMetricsByReferringNetworks)
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/bitly/api/click_metric.rb', line 53 def self.list_referring_networks(client:, group_guid:, unit: nil, units: nil, size: nil, unit_reference: nil) list_metrics( client: client, path: "/groups/#{group_guid}/referring_networks", unit: unit, units: units, unit_reference: unit_reference, size: size ) end |