Class: Bitly::API::ShortenCounts
- Inherits:
-
Object
- Object
- Bitly::API::ShortenCounts
- Includes:
- Base
- Defined in:
- lib/bitly/api/shorten_counts.rb
Defined Under Namespace
Classes: Metric
Instance Attribute Summary collapse
-
#metrics ⇒ Object
readonly
Returns the value of attribute metrics.
Attributes included from Base
Class Method Summary collapse
- .attributes ⇒ Object
-
.by_group(client:, group_guid:) ⇒ Bitly::API::ShortenCounts
Shorten counts by group [‘GET /v4/groups/group_guid/shorten_counts`](dev.bitly.com/api-reference/#getGroupShortenCounts).
-
.by_organization(client:, organization_guid:) ⇒ Bitly::API::ShortenCounts
Shorten counts by organization [‘GET /v4/organizations/organization_guid/shorten_counts`](dev.bitly.com/api-reference/#getOrganizationShortenCounts).
Instance Method Summary collapse
-
#initialize(data:, response: nil) ⇒ ShortenCounts
constructor
A new instance of ShortenCounts.
Methods included from Base
Constructor Details
#initialize(data:, response: nil) ⇒ ShortenCounts
Returns a new instance of ShortenCounts.
52 53 54 55 56 57 58 |
# File 'lib/bitly/api/shorten_counts.rb', line 52 def initialize(data:, response: nil) assign_attributes(data) @metrics = data["metrics"].map do |metric| Metric.new(metric["key"], metric["value"]) end @response = response end |
Instance Attribute Details
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics.
14 15 16 |
# File 'lib/bitly/api/shorten_counts.rb', line 14 def metrics @metrics end |
Class Method Details
.attributes ⇒ Object
9 10 11 |
# File 'lib/bitly/api/shorten_counts.rb', line 9 def self.attributes [:units, :facet, :unit_reference, :unit] end |
.by_group(client:, group_guid:) ⇒ Bitly::API::ShortenCounts
Shorten counts by group [‘GET /v4/groups/group_guid/shorten_counts`](dev.bitly.com/api-reference/#getGroupShortenCounts)
30 31 32 33 |
# File 'lib/bitly/api/shorten_counts.rb', line 30 def self.by_group(client:, group_guid:) response = client.request(path: "/groups/#{group_guid}/shorten_counts") new(data: response.body, response: response) end |
.by_organization(client:, organization_guid:) ⇒ Bitly::API::ShortenCounts
Shorten counts by organization [‘GET /v4/organizations/organization_guid/shorten_counts`](dev.bitly.com/api-reference/#getOrganizationShortenCounts)
47 48 49 50 |
# File 'lib/bitly/api/shorten_counts.rb', line 47 def self.by_organization(client:, organization_guid:) response = client.request(path: "/organizations/#{organization_guid}/shorten_counts") new(data: response.body, response: response) end |