bitly 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0a2dd617bd9c23263a1db205f8ea95359c34273df7eecc5ca9565536a03c802
4
- data.tar.gz: 4f0dac7f35a238a61b9ec36390df824170b576f15e8f111203bf83a8f600993d
3
+ metadata.gz: '095c28dc60c45e049f9fde01119376322ea8438ca0b9074479de7bd903af55ed'
4
+ data.tar.gz: 59df185cab7f082fbdfedc7bc857c79a4bba69b9913d3b91e40effb4852e852e
5
5
  SHA512:
6
- metadata.gz: cc10e4a46caeb7155292380f8c61feec74cf19ce9da36ee49c9b7dbff763b5c4703b58c9e2ded557cfb6426fa7f68532914a49350bc9f5e4f8c25a57ff7d3e82
7
- data.tar.gz: 1935c386fc1d489a532de2459222f9a069a3a6f0a258d58178c16694e131d8be246226464fe1f2f83a40db1c333c0422d1c60905c0ec1dfb23492ae927db2c93
6
+ metadata.gz: dc18dd77b07180334af8adb1961fcefc32b56b2920c7400d6d6e04e33fff054cf1086499defae0cf0c88388afbc4cddd167d365ba87ca3be553d0508a3dc104a
7
+ data.tar.gz: 77b804e7d11ba3f82ca7a5329357261a75b592e94b3eb761f120fd0380a0ddca62ee1f717601885e936b5f5e081d6f01f086ef3b4e04d464237167f535497359
data/Gemfile CHANGED
@@ -4,3 +4,7 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in bitly.gemspec
6
6
  gemspec
7
+
8
+ group :development do
9
+ gem 'rspec', '< 3.10.0'
10
+ end
data/History.txt CHANGED
@@ -1,6 +1,11 @@
1
1
  === Ongoing
2
2
 
3
- ...
3
+ === 3.0.0 / 2022-11-08
4
+
5
+ * **Breaking** Removes Group DELETE and Oauth Apps endpoints
6
+ * Updates all URLs in the documentation
7
+ * Adds click_metrics_by_country to Bitlink instances
8
+ * Adds request options and proxy options to the Net::HTTP adapter
4
9
 
5
10
  === 2.1.0 / 2022-10-21
6
11
 
data/README.md CHANGED
@@ -18,7 +18,9 @@ A Ruby gem for using the version 4 [Bitly API](https://dev.bitly.com/) to shorte
18
18
  * [Custom Bitlinks](#custom-bitlinks)
19
19
  * [Campaigns](#campaigns)
20
20
  * [BSDs (Branded Short Domains)](#bsds-branded-short-domains)
21
- * [OAuth Apps](#oauth-apps)
21
+ * [Webhooks](#webhooks)
22
+ * [Customising HTTP requests](#customising-http-requests)
23
+ * [Build your own adapter](#build-your-own-adapter)
22
24
  * [Development](#development)
23
25
  * [Contributing](#contributing)
24
26
  * [License](#license)
@@ -86,86 +88,127 @@ bitlink.long_url
86
88
 
87
89
  ## Available API Endpoints
88
90
 
89
- This gem supports the following active v4 API endpoints for the[Bitly API](https://dev.bitly.com/v4_documentation.html).
91
+ This gem supports the following active v4 API endpoints for the[Bitly API](https://dev.bitly.com/api-reference).
90
92
 
91
93
  ### Groups
92
94
 
93
95
  [Groups documentation](docs/groups.md)
94
96
 
95
- - [x] [Retrieve groups (`GET /v4/groups`)](https://dev.bitly.com/v4/#operation/getGroups)
96
- - [x] [Retrieve group (`GET /v4/groups/{group_guid}`)](https://dev.bitly.com/v4/#operation/getGroup)
97
- - [x] [Update group (`PATCH /v4/groups/{group_guid}`)](https://dev.bitly.com/v4/#operation/updateGroup)
98
- - [x] [Delete group (`DELETE /v4/groups/{group_guid}`)](https://dev.bitly.com/v4/#operation/deleteGroup)
99
- - [x] [Retrieve tags by group (`GET /v4/groups/{group_guid}/tags`)](https://dev.bitly.com/v4/#operation/getGroupTags)
100
- - [x] [Retrieve group preferences (`GET /v4/groups/{group_guid}/preferences`)](https://dev.bitly.com/v4/#operation/getGroupPreferences)
101
- - [x] [Update group preferences (`PATCH /v4/groups/{group_guid}/preferences`)](https://dev.bitly.com/v4/#operation/updateGroupPreferences)
102
- - [x] [Retrieve Bitlinks by group (`GET /v4/groups/{group_guid}/bitlinks`)](https://dev.bitly.com/v4/#operation/getBitlinksByGroup)
103
- - [x] [Retrieve sorted Bitlinks by group (`GET /v4/groups/{group_guid}/bitlinks/{sort}`)](https://dev.bitly.com/v4/#operation/getSortedBitlinks)
104
- - [x] [Retrieve group shorten counts (`GET /v4/groups/{group_guid}/shorten_counts`)](https://dev.bitly.com/v4/#operation/getGroupShortenCounts)
105
- - [x] [Retrieve click metrics for a group by referring networks (`GET /v4/groups/{group_guid}/referring_networks`)](https://dev.bitly.com/v4/#operation/GetGroupMetricsByReferringNetworks)
106
- - [x] [Retrieve click metrics for a group by countries (`GET /v4/groups/{group_guid}/countries`)](https://dev.bitly.com/v4/#operation/getGroupMetricsByCountries)
97
+ - [x] [Retrieve groups (`GET /v4/groups`)](https://dev.bitly.com/api-reference/#getGroups)
98
+ - [x] [Retrieve group (`GET /v4/groups/{group_guid}`)](https://dev.bitly.com/api-reference/#getGroup)
99
+ - [x] [Update group (`PATCH /v4/groups/{group_guid}`)](https://dev.bitly.com/api-reference/#updateGroup)
100
+ - [x] [Retrieve tags by group (`GET /v4/groups/{group_guid}/tags`)](https://dev.bitly.com/api-reference/#getGroupTags)
101
+ - [x] [Retrieve group preferences (`GET /v4/groups/{group_guid}/preferences`)](https://dev.bitly.com/api-reference/#getGroupPreferences)
102
+ - [x] [Update group preferences (`PATCH /v4/groups/{group_guid}/preferences`)](https://dev.bitly.com/api-reference/#updateGroupPreferences)
103
+ - [x] [Retrieve Bitlinks by group (`GET /v4/groups/{group_guid}/bitlinks`)](https://dev.bitly.com/api-reference/#getBitlinksByGroup)
104
+ - [x] [Retrieve sorted Bitlinks by group (`GET /v4/groups/{group_guid}/bitlinks/{sort}`)](https://dev.bitly.com/api-reference/#getSortedBitlinks)
105
+ - [x] [Retrieve group shorten counts (`GET /v4/groups/{group_guid}/shorten_counts`)](https://dev.bitly.com/api-reference/#getGroupShortenCounts)
106
+ - [x] [Retrieve click metrics for a group by referring networks (`GET /v4/groups/{group_guid}/referring_networks`)](https://dev.bitly.com/api-reference/#GetGroupMetricsByReferringNetworks)
107
+ - [x] [Retrieve click metrics for a group by countries (`GET /v4/groups/{group_guid}/countries`)](https://dev.bitly.com/api-reference/#getGroupMetricsByCountries)
108
+ - [ ] __[premium]__ [Retrieve click metrics for a group by city (`GET /v4/groups/{group_guid}/cities`)](https://dev.bitly.com/api-reference/#getGroupMetricsByCities)
109
+ - [ ] __[premium]__ [Get group overrides (`GET /v4/groups/{group_guid}/overrides`)](https://dev.bitly.com/api-reference/#getOverridesForGroups)
107
110
 
108
111
  ### Organizations
109
112
 
110
113
  [Organizations documentation](docs/organizations.md)
111
114
 
112
- - [x] [Retrieve organizations (`GET /v4/organizations`)](https://dev.bitly.com/v4/#operation/getOrganizations)
113
- - [x] [Retrieve organization (`GET /v4/organizations/{organization_guid}`)](https://dev.bitly.com/v4/#operation/getOrganization)
114
- - [x] [Retrieve organization shorten counts (`GET /v4/organizations/{organization_guid}/shorten_counts`)](https://dev.bitly.com/v4/#operation/getOrganizationShortenCounts)
115
+ - [x] [Retrieve organizations (`GET /v4/organizations`)](https://dev.bitly.com/api-reference/#getOrganizations)
116
+ - [x] [Retrieve organization (`GET /v4/organizations/{organization_guid}`)](https://dev.bitly.com/api-reference/#getOrganization)
117
+ - [x] [Retrieve organization shorten counts (`GET /v4/organizations/{organization_guid}/shorten_counts`)](https://dev.bitly.com/api-reference/#getOrganizationShortenCounts)
115
118
 
116
119
  ### Users
117
120
 
118
121
  [Users documentation](docs/users.md)
119
122
 
120
- - [x] [Retrieve user (`GET /v4/user`)](https://dev.bitly.com/v4/#operation/getUser)
121
- - [x] [Update user (`PATCH /v4/user`)](https://dev.bitly.com/v4/#operation/updateUser)
123
+ - [x] [Retrieve user (`GET /v4/user`)](https://dev.bitly.com/api-reference/#getUser)
124
+ - [x] [Update user (`PATCH /v4/user`)](https://dev.bitly.com/api-reference/#updateUser)
122
125
 
123
126
  ### Bitlinks
124
127
 
125
128
  [Bitlinks documentation](docs/bitlinks.md)
126
129
 
127
- - [x] [Shorten a link (`POST /v4/shorten`)](https://dev.bitly.com/v4/#operation/createBitlink)
128
- - [x] [Expand a Bitlink (`POST /v4/expand`)](https://dev.bitly.com/v4/#operation/expandBitlink)
129
- - [x] [Retrieve a Bitlink (`GET /v4/bitlink/{bitlink}`)](https://dev.bitly.com/v4/#operation/getBitlink)
130
- - [x] [Create a Bitlink (`POST /v4/bitlinks`)](https://dev.bitly.com/v4/#operation/createFullBitlink)
131
- - [x] [Update a Bitlink (`PATCH /v4/bitlink/{bitlink}`)](https://dev.bitly.com/v4/#operation/updateBitlink)
132
- - [x] [Get clicks for a Bitlink (`GET /v4/bitlink/{bitlink}/clicks`)](https://dev.bitly.com/v4/#operation/getClicksForBitlink)
133
- - [x] [Get clicks summary for a Bitlink (`GET /v4/bitlink/{bitlink}/clicks/summary`)](https://dev.bitly.com/v4/#operation/getClicksSummaryForBitlink)
134
- - [x] [Get metrics for a Bitlink by countries (`GET /v4/bitlinks/{bitlink}/countries`)](https://dev.bitly.com/v4/#operation/getMetricsForBitlinkByCountries)
135
- - [x] [Get metrics for a Bitlink by referrers (`GET /v4/bitlinks/{bitlink}/referrers`)](https://dev.bitly.com/v4/#operation/getMetricsForBitlinkByReferrers)
136
- - [x] [Get metrics for a Bitlink by referring domains (`GET /v4/bitlinks/{bitlink}/referring_domains`)](https://dev.bitly.com/v4/#operation/getMetricsForBitlinkByReferringDomains)
137
- - [x] [Get metrics for a Bitlink by referrers by domain (`GET /v4/bitlinks/{bitlink}/referrers_by_domains`)](https://dev.bitly.com/v4/#operation/getMetricsForBitlinkByReferrersByDomains)
138
- - [ ] __[premium]__ [Get a QR code for a Bitlink (`GET /v4/{bitlink}/qr`)](https://dev.bitly.com/v4/#operation/getBitlinkQRCode)
130
+ - [x] [Shorten a link (`POST /v4/shorten`)](https://dev.bitly.com/api-reference/#createBitlink)
131
+ - [x] [Expand a Bitlink (`POST /v4/expand`)](https://dev.bitly.com/api-reference/#expandBitlink)
132
+ - [x] [Retrieve a Bitlink (`GET /v4/bitlinks/{bitlink}`)](https://dev.bitly.com/api-reference/#getBitlink)
133
+ - [x] [Create a Bitlink (`POST /v4/bitlinks`)](https://dev.bitly.com/api-reference/#createFullBitlink)
134
+ - [x] [Update a Bitlink (`PATCH /v4/bitlinks/{bitlink}`)](https://dev.bitly.com/api-reference/#updateBitlink)
135
+ - [ ] [Delete an unedited hash Bitlink (`DELETE /v4/bitlinks/{bitlink}`)](https://dev.bitly.com/api-reference/#deleteBitlink)
136
+ - [x] [Get clicks for a Bitlink (`GET /v4/bitlinks/{bitlink}/clicks`)](https://dev.bitly.com/api-reference/#getClicksForBitlink)
137
+ - [x] [Get clicks summary for a Bitlink (`GET /v4/bitlinks/{bitlink}/clicks/summary`)](https://dev.bitly.com/api-reference/#getClicksSummaryForBitlink)
138
+ - [x] [Get metrics for a Bitlink by countries (`GET /v4/bitlinks/{bitlink}/countries`)](https://dev.bitly.com/api-reference/#getMetricsForBitlinkByCountries)
139
+ - [x] [Get metrics for a Bitlink by referrers (`GET /v4/bitlinks/{bitlink}/referrers`)](https://dev.bitly.com/api-reference/#getMetricsForBitlinkByReferrers)
140
+ - [x] [Get metrics for a Bitlink by referring domains (`GET /v4/bitlinks/{bitlink}/referring_domains`)](https://dev.bitly.com/api-reference/#getMetricsForBitlinkByReferringDomains)
141
+ - [x] [Get metrics for a Bitlink by referrers by domain (`GET /v4/bitlinks/{bitlink}/referrers_by_domains`)](https://dev.bitly.com/api-reference/#getMetricsForBitlinkByReferrersByDomains)
142
+ - [ ] __[premium]__ [Get metrics for a Bitlink by city (`GET /v4/bitlinks/{bitlink}/cities`)](https://dev.bitly.com/api-reference/#getMetricsForBitlinkByCities)
143
+ - [ ] __[premium]__ [Get metrics for a Bitlink by device type (`GET /v4/bitlinks/{bitlink}/devices`)](https://dev.bitly.com/api-reference/#getMetricsForBitlinkByDevices)
144
+ - [ ] __[premium]__ [Retrieve a QR code for a Bitlink (`GET /v4/bitlinks/{bitlink}/qr`)](https://dev.bitly.com/api-reference/#getBitlinkQRCode)
145
+ - [ ] __[premium]__ [Update a QR code (`PATCH /v4/bitlinks/{bitlink}/qr`)](https://dev.bitly.com/api-reference/#updateBitlinkQRCode)
146
+ - [ ] __[premium]__ [Create a QR code (`POST /v4/bitlinks/{bitlink}/qr`)](https://dev.bitly.com/api-reference/#createBitlinkQRCode)
139
147
 
140
148
  ### Custom Bitlinks
141
149
 
142
- - [ ] [Add custom Bitlink (`POST /v4/custom_bitlinks`)](https://dev.bitly.com/v4/#operation/addCustomBitlink)
143
- - [ ] __[premium]__ [Retrieve custom Bitlink (`GET /v4/custom_bitlinks/{custom_bitlink}`)](https://dev.bitly.com/v4/#operation/getCustomBitlink)
144
- - [ ] __[premium]__ [Update custom Bitlink (`PATCH /v4/custom_bitlink/{custom_bitlink}`)](https://dev.bitly.com/v4/#operation/updateCustomBitlink)
145
- - [ ] __[premium]__ [Get metrics for a custom Bitlink by destination (`GET /v4/custom_bitlinks/{custom_bitlink}/clicks_by_destination`)](https://dev.bitly.com/v4/#operation/getCustomBitlinkMetricsByDestination)
150
+ - [ ] [Add custom Bitlink (`POST /v4/custom_bitlinks`)](https://dev.bitly.com/api-reference/#addCustomBitlink)
151
+ - [ ] __[premium]__ [Retrieve custom Bitlink (`GET /v4/custom_bitlinks/{custom_bitlink}`)](https://dev.bitly.com/api-reference/#getCustomBitlink)
152
+ - [ ] __[premium]__ [Update custom Bitlink (`PATCH /v4/custom_bitlinks/{custom_bitlink}`)](https://dev.bitly.com/api-reference/#updateCustomBitlink)
153
+ - [ ] __[premium]__ [Get metrics for a custom Bitlink by destination (`GET /v4/custom_bitlinks/{custom_bitlink}/clicks_by_destination`)](https://dev.bitly.com/api-reference/#getCustomBitlinkMetricsByDestination)
154
+ - [ ] __[premium]__ [Get clicks for a custom Bitlin's entire history (`GET /v4/custom_bitlinks/{custom_bitlink}/clicks`)](https://dev.bitly.com/api-reference/#getClicksForCustomBitlink)
146
155
 
147
156
  ### Campaigns
148
157
 
149
- - [ ] __[premium]__ [Retrieve campaigns (`GET /v4/campaigns`)](https://dev.bitly.com/v4/#operation/getCampaigns)
150
- - [ ] __[premium]__ [Create campaign (`POST /v4/campaigns`)](https://dev.bitly.com/v4/#operation/createCampaign)
151
- - [ ] __[premium]__ [Retrieve campaign (`GET /v4/campaigns/{campaign_guid}`)](https://dev.bitly.com/v4/#operation/getCampaign)
152
- - [ ] __[premium]__ [Update campaign (`PATCH /v4/campaigns/{campaign_guid}`)](https://dev.bitly.com/v4/#operation/updateCampaign)
153
- - [ ] __[premium]__ [Retrieve channels (`GET /v4/channels`)](https://dev.bitly.com/v4/#operation/getChannels)
154
- - [ ] __[premium]__ [Create channel (`POST /v4/channels`)](https://dev.bitly.com/v4/#operation/createChannel)
155
- - [ ] __[premium]__ [Retrieve channel (`GET /v4/channels/{channel_guid}`)](https://dev.bitly.com/v4/#operation/getChannel)
156
- - [ ] __[premium]__ [Update channel (`PATCH /v4/channels/{channel_guid}`)](https://dev.bitly.com/v4/#operation/updateChannel)
158
+ - [ ] __[premium]__ [Retrieve campaigns (`GET /v4/campaigns`)](https://dev.bitly.com/api-reference/#getCampaigns)
159
+ - [ ] __[premium]__ [Create campaign (`POST /v4/campaigns`)](https://dev.bitly.com/api-reference/#createCampaign)
160
+ - [ ] __[premium]__ [Retrieve campaign (`GET /v4/campaigns/{campaign_guid}`)](https://dev.bitly.com/api-reference/#getCampaign)
161
+ - [ ] __[premium]__ [Update campaign (`PATCH /v4/campaigns/{campaign_guid}`)](https://dev.bitly.com/api-reference/#updateCampaign)
162
+ - [ ] __[premium]__ [Retrieve channels (`GET /v4/channels`)](https://dev.bitly.com/api-reference/#getChannels)
163
+ - [ ] __[premium]__ [Create channel (`POST /v4/channels`)](https://dev.bitly.com/api-reference/#createChannel)
164
+ - [ ] __[premium]__ [Retrieve channel (`GET /v4/channels/{channel_guid}`)](https://dev.bitly.com/api-reference/#getChannel)
165
+ - [ ] __[premium]__ [Update channel (`PATCH /v4/channels/{channel_guid}`)](https://dev.bitly.com/api-reference/#updateChannel)
157
166
 
158
167
  ### BSDs (Branded Short Domains)
159
168
 
160
169
  [Branded Short Domains documentation](docs/branded_short_domains.md)
161
170
 
162
- - [x] [Retrieve BSDs (`GET /v4/bsds`)](https://dev.bitly.com/v4/#operation/getBSDs)
171
+ - [x] [Retrieve BSDs (`GET /v4/bsds`)](https://dev.bitly.com/api-reference/#getBSDs)
163
172
 
164
- ### OAuth Apps
173
+ ### Webhooks
165
174
 
166
- [OAuth Apps documentation](docs/oauth_apps.md)
175
+ - [ ] __[premium]__ [Get webhooks (`GET /v4/organizations/{organization_guid}/webhooks`)](https://dev.bitly.com/api-reference/#getWebhooks)
176
+ - [ ] __[premium]__ [Create a webhook (`POST /v4/webhooks`)](https://dev.bitly.com/api-reference/#createWebhook)
177
+ - [ ] __[premium]__ [Retrieve a webhook (`GET /v4/webhooks/{webhook_guid}`)](https://dev.bitly.com/api-reference/#getWebhook)
178
+ - [ ] __[premium]__ [Update a webhook (`POST /v4/webhooks/{webhook_guid`)](https://dev.bitly.com/api-reference/#updateWebhook)
179
+ - [ ] __[premium]__ [Delete a webhook (`DELETE /v4/webhooks/{webhook_guid}`)](https://dev.bitly.com/api-reference/#deleteWebhook)
180
+ - [ ] __[premium]__ [Verify a webhook (`POST /v4/webhooks/{webhook_guid}/verify`)](https://dev.bitly.com/api-reference/#verifyWebhook)
167
181
 
168
- - [x] [Retrieve OAuth App (`GET /v4/apps/{client_id}`)](https://dev.bitly.com/v4/#operation/getOAuthApp)
182
+ ## Customising HTTP requests
183
+
184
+ This gem comes with an HTTP client that can use different adapters. It ships with a `Net::HTTP` adapter that it uses by default.
185
+
186
+ If you want to control the connection, you can create your own instance of the `Net::HTTP` adapter and pass it options for an HTTP proxy or options that control the request. For example, to control the `read_timeout` you can do this:
187
+
188
+ ```ruby
189
+ adapter = Bitly::HTTP::Adapters::NetHTTP.new(request_options: { read_timeout: 1 })
190
+ http_client = Bitly::HTTP::Client.new(adapter)
191
+ api_client = Bitly::API::Client.new(http: http_client, token: token)
192
+ ```
193
+
194
+ Similarly, you can use an HTTP proxy with the adapter by passing the proxy variables to the adapter's constructor.
195
+
196
+ ```ruby
197
+ adapter = Bitly::HTTP::Adapters::NetHTTP.new(proxy_addr: "example.com", proxy_port: 80, proxy_user: "username", proxy_pass: "password")
198
+ http_client = Bitly::HTTP::Client.new(adapter)
199
+ api_client = Bitly::API::Client.new(http: http_client, token: token)
200
+ ```
201
+
202
+ ### Build your own adapter
203
+
204
+ If you want even more control over the request, you can build your own adapter. An HTTP adapter within this gem must have a `request` instance method that receives a `Bitly::HTTP::Request` object and returns an array of four objects:
205
+
206
+ 1. The response status code
207
+ 2. The body of the response as a string
208
+ 3. The response headers as a hash
209
+ 4. A boolean denoting whether the response was a success or not
210
+
211
+ See `./src/bitly/http/adapters/net_http.rb` for an example.
169
212
 
170
213
  ## Development
171
214
 
@@ -22,7 +22,7 @@ module Bitly
22
22
 
23
23
  ##
24
24
  # Get the clicks for a bitlink.
25
- # [`GET /v4/bitlink/{bitlink}/clicks`](https://dev.bitly.com/v4/#operation/getClicksForBitlink)
25
+ # [`GET /v4/bitlink/{bitlink}/clicks`](https://dev.bitly.com/api-reference/#getClicksForBitlink)
26
26
  #
27
27
  # @param client [Bitly::API::Client] An authorized API client
28
28
  # @param bitlink [String] The Bitlink for which you want the clicks
@@ -19,7 +19,7 @@ module Bitly
19
19
 
20
20
  ##
21
21
  # Shortens a long url.
22
- # [`POST /v4/shorten`](https://dev.bitly.com/v4/#operation/createBitlink)
22
+ # [`POST /v4/shorten`](https://dev.bitly.com/api-reference/#createBitlink)
23
23
  #
24
24
  # @example
25
25
  # bitlink = Bitly::API::Bitlink.shorten(client: client, long_url: long_url)
@@ -47,7 +47,7 @@ module Bitly
47
47
  ##
48
48
  # Creates a new Bitlink from a long URL. Similar to #shorten but takes
49
49
  # more parameters.
50
- # [`POST /v4/bitlinks`](https://dev.bitly.com/v4/#operation/createFullBitlink)
50
+ # [`POST /v4/bitlinks`](https://dev.bitly.com/api-reference/#createFullBitlink)
51
51
  #
52
52
  # @example
53
53
  # bitlink = Bitly::API::Bitlink.create(client: client, long_url: long_url)
@@ -81,7 +81,7 @@ module Bitly
81
81
 
82
82
  ##
83
83
  # Return information about a bitlink
84
- # [`GET /v4/bitlink/{bitlink}`](https://dev.bitly.com/v4/#operation/getBitlink)
84
+ # [`GET /v4/bitlinks/{bitlink}`](https://dev.bitly.com/api-reference/#getBitlink)
85
85
  #
86
86
  # @example
87
87
  # bitlink = Bitly::API::Bitlink.fetch(client: client, bitlink: "bit.ly/example")
@@ -98,7 +98,7 @@ module Bitly
98
98
 
99
99
  ##
100
100
  # Return public information about a bitlink
101
- # [`POST /v4/expand`](https://dev.bitly.com/v4/#operation/expandBitlink)
101
+ # [`POST /v4/expand`](https://dev.bitly.com/api-reference/#expandBitlink)
102
102
  #
103
103
  # @example
104
104
  # bitlink = Bitly::API::Bitlink.expand(client: client, bitlink: "bit.ly/example")
@@ -115,7 +115,7 @@ module Bitly
115
115
 
116
116
  ##
117
117
  # Retrieve a list of bitlinks by group
118
- # [`GET /v4/groups/{group_guid}/bitlinks`](https://dev.bitly.com/v4/#operation/getBitlinksByGroup)
118
+ # [`GET /v4/groups/{group_guid}/bitlinks`](https://dev.bitly.com/api-reference/#getBitlinksByGroup)
119
119
  #
120
120
  # @example
121
121
  # bitlinks = Bitly::API::Bitlink.list(client: client, group_guid: guid)
@@ -192,7 +192,7 @@ module Bitly
192
192
 
193
193
  ##
194
194
  # Returns a list of Bitlinks sorted by clicks.
195
- # [`GET /v4/groups/{group_guid}/bitlinks/{sort}`](https://dev.bitly.com/v4/#operation/getSortedBitlinks)
195
+ # [`GET /v4/groups/{group_guid}/bitlinks/{sort}`](https://dev.bitly.com/api-reference/#getSortedBitlinks)
196
196
  #
197
197
  # The API returns a separate list of the links and the click counts, but
198
198
  # this method assigns the number of clicks for each link to the Bitlink
@@ -257,7 +257,7 @@ module Bitly
257
257
 
258
258
  ##
259
259
  # Update the Bitlink.
260
- # [`PATCH /v4/bitlink/{bitlink}`](https://dev.bitly.com/v4/#operation/updateBitlink)
260
+ # [`PATCH /v4/bitlinks/{bitlink}`](https://dev.bitly.com/api-reference/#getClicksSummaryForBitlink)
261
261
  #
262
262
  # The parameters listed below are from the documentation. Some only work
263
263
  # if you have a Bitly Pro account.
@@ -315,7 +315,7 @@ module Bitly
315
315
  self
316
316
  end
317
317
 
318
- # [`GET /v4/bitlink/{bitlink}/clicks/summary`](https://dev.bitly.com/v4/#operation/getClicksSummaryForBitlink)
318
+ # [`GET /v4/bitlinks/{bitlink}/clicks/summary`](https://dev.bitly.com/api-reference/#getClicksSummaryForBitlink)
319
319
  #
320
320
  # @return [Bitly::API::Bitlink::ClicksSummary]
321
321
  def clicks_summary(unit: nil, units: nil, unit_reference: nil, size: nil)
@@ -324,7 +324,7 @@ module Bitly
324
324
 
325
325
  ##
326
326
  # Get the clicks for the bitlink.
327
- # [`GET /v4/bitlink/{bitlink}/clicks`](https://dev.bitly.com/v4/#operation/getClicksForBitlink)
327
+ # [`GET /v4/bitlinks/{bitlink}/clicks`](https://dev.bitly.com/api-reference/#getClicksForBitlink)
328
328
  #
329
329
  # @param sort [String] The data to sort on. Default and only option is
330
330
  # "clicks".
@@ -341,6 +341,24 @@ module Bitly
341
341
  def link_clicks(unit: nil, units: nil, unit_reference: nil, size: nil)
342
342
  LinkClick.list(client: @client, bitlink: id, unit: unit, units: units, unit_reference: unit_reference, size: size)
343
343
  end
344
+
345
+ ##
346
+ # Get metrics for a Bitlink by country
347
+ # [`GET /v4/bitlinks/{bitlink}/countries`](https://dev.bitly.com/api-reference/#getMetricsForBitlinkByCountries)
348
+ #
349
+ # @param unit [String] A unit of time. Default is "day" and can be
350
+ # "minute", "hour", "day", "week" or "month"
351
+ # @param units [Integer] An integer representing the time units to query
352
+ # data for. pass -1 to return all units of time. Defaults to -1.
353
+ # @param unit_reference [String] An ISO-8601 timestamp, indicating the
354
+ # most recent time for which to pull metrics. Will default to current
355
+ # time.
356
+ # @param size [Integer] The number of links to be returned. Defaults to 50
357
+ #
358
+ # @return [Bitly::API::ClickMetric::List]
359
+ def click_metrics_by_country(unit: nil, units: nil, unit_reference: nil, size: nil)
360
+ ClickMetric.list_countries_by_bitlink(client: @client, bitlink: id, unit: unit, units: units, unit_reference: unit_reference, size: size)
361
+ end
344
362
  end
345
363
  end
346
364
  end
data/lib/bitly/api/bsd.rb CHANGED
@@ -8,7 +8,7 @@ module Bitly
8
8
 
9
9
  ##
10
10
  # Fetch Branded Short Domains (BSDs).
11
- # [`GET /v4/bsds`](https://dev.bitly.com/v4/#operation/getBSDs)
11
+ # [`GET /v4/bsds`](https://dev.bitly.com/api-reference/#getBSDs)
12
12
  #
13
13
  # @example
14
14
  # bsds = Bitly::API::BSD.list(client: client)
@@ -36,7 +36,7 @@ module Bitly
36
36
 
37
37
  ##
38
38
  # Gets the referring networks for the group.
39
- # [`GET /v4/groups/{group_guid}/referring_networks`](https://dev.bitly.com/v4/#operation/GetGroupMetricsByReferringNetworks)
39
+ # [`GET /v4/groups/{group_guid}/referring_networks`](https://dev.bitly.com/api-reference/#GetGroupMetricsByReferringNetworks)
40
40
  #
41
41
  # @param client [Bitly::API::Client] An authorized API client
42
42
  # @param group_guid [String] The guid of the group
@@ -63,7 +63,7 @@ module Bitly
63
63
 
64
64
  ##
65
65
  # Gets the country click metrics for the group.
66
- # [`GET /v4/groups/{group_guid}/countries`](https://dev.bitly.com/v4/#operation/getGroupMetricsByCountries)
66
+ # [`GET /v4/groups/{group_guid}/countries`](https://dev.bitly.com/api-reference/#getGroupMetricsByCountries)
67
67
  #
68
68
  # @param client [Bitly::API::Client] An authorized API client
69
69
  # @param group_guid [String] The guid of the group
@@ -100,6 +100,22 @@ module Bitly
100
100
  )
101
101
  end
102
102
 
103
+ ##
104
+ # Get metrics for a Bitlink by country
105
+ # [`GET /v4/bitlinks/{bitlink}/countries`](https://dev.bitly.com/api-reference/#getMetricsForBitlinkByCountries)
106
+ #
107
+ # @param client [Bitly::API::Client] An authorized API client
108
+ # @param bitlink [String] The bitlink you want information about
109
+ # @param unit [String] A unit of time. Default is "day" and can be
110
+ # "minute", "hour", "day", "week" or "month"
111
+ # @param units [Integer] An integer representing the time units to query
112
+ # data for. pass -1 to return all units of time. Defaults to -1.
113
+ # @param unit_reference [String] An ISO-8601 timestamp, indicating the
114
+ # most recent time for which to pull metrics. Will default to current
115
+ # time.
116
+ # @param size [Integer] The number of links to be returned. Defaults to 50
117
+ #
118
+ # @return [Bitly::API::ClickMetric::List]
103
119
  def self.list_countries_by_bitlink(client:, bitlink:, unit: nil, units: nil, size: nil, unit_reference: nil)
104
120
  bitlink = Bitlink::Utils.normalise_bitlink(bitlink: bitlink)
105
121
  list_metrics(
@@ -58,7 +58,7 @@ module Bitly
58
58
 
59
59
  ##
60
60
  # Shortens a long URL.
61
- # [`POST /v4/shorten`](https://dev.bitly.com/v4/#operation/createBitlink)
61
+ # [`POST /v4/shorten`](https://dev.bitly.com/api-reference/#createBitlink)
62
62
  #
63
63
  # @example
64
64
  # client.shorten(long_url: "http://example.com")
@@ -75,7 +75,7 @@ module Bitly
75
75
 
76
76
  ##
77
77
  # Creates a Bitlink with more options than #shorten.
78
- # [`POST /v4/bitlinks`](https://dev.bitly.com/v4/#operation/createFullBitlink)
78
+ # [`POST /v4/bitlinks`](https://dev.bitly.com/api-reference/#createFullBitlink)
79
79
  #
80
80
  # @example
81
81
  # bitlink = client.create_bitlink(long_url: "http://example.com", title: "An example")
@@ -96,7 +96,7 @@ module Bitly
96
96
 
97
97
  ##
98
98
  # Return information about a bitlink
99
- # [`GET /v4/bitlink/{bitlink}`](https://dev.bitly.com/v4/#operation/getBitlink)
99
+ # [`GET /v4/bitlink/{bitlink}`](https://dev.bitly.com/api-reference/#getBitlink)
100
100
  #
101
101
  # @example
102
102
  # bitlink = client.bitlink(bitlink: "bit.ly/example")
@@ -110,7 +110,7 @@ module Bitly
110
110
 
111
111
  ##
112
112
  # Return public information about a bitlink.
113
- # [`POST /v4/expand`](https://dev.bitly.com/v4/#operation/expandBitlink)
113
+ # [`POST /v4/expand`](https://dev.bitly.com/api-reference/#expandBitlink)
114
114
  #
115
115
  # @example
116
116
  # bitlink = client.expand(bitlink: "bit.ly/example")
@@ -124,7 +124,7 @@ module Bitly
124
124
 
125
125
  ##
126
126
  # Returns a list of Bitlinks sorted by clicks.
127
- # [`GET /v4/groups/{group_guid}/bitlinks/{sort}`](https://dev.bitly.com/v4/#operation/getSortedBitlinks)
127
+ # [`GET /v4/groups/{group_guid}/bitlinks/{sort}`](https://dev.bitly.com/api-reference/#getSortedBitlinks)
128
128
  #
129
129
  # The API returns a separate list of the links and the click counts, but
130
130
  # this method assigns the number of clicks for each link to the Bitlink
@@ -169,7 +169,7 @@ module Bitly
169
169
 
170
170
  ##
171
171
  # Update a Bitlink.
172
- # [`PATCH /v4/bitlink/{bitlink}`](https://dev.bitly.com/v4/#operation/updateBitlink)
172
+ # [`PATCH /v4/bitlink/{bitlink}`](https://dev.bitly.com/api-reference/#updateBitlink)
173
173
  #
174
174
  # The parameters listed below are from the documentation. Some only work
175
175
  # if you have a Bitly Pro account.
@@ -225,7 +225,7 @@ module Bitly
225
225
 
226
226
  ##
227
227
  # Get the clicks for a bitlink.
228
- # [`GET /v4/bitlink/{bitlink}/clicks`](https://dev.bitly.com/v4/#operation/getClicksForBitlink)
228
+ # [`GET /v4/bitlink/{bitlink}/clicks`](https://dev.bitly.com/api-reference/#getClicksForBitlink)
229
229
  #
230
230
  # @param bitlink [String] The Bitlink for which you want the clicks
231
231
  # @param sort [String] The data to sort on. Default and only option is
@@ -253,7 +253,7 @@ module Bitly
253
253
 
254
254
  ##
255
255
  # Get a list of organizations from the API.
256
- # [`GET /v4/organizations`](https://dev.bitly.com/v4/#operation/getOrganizations)
256
+ # [`GET /v4/organizations`](https://dev.bitly.com/api-reference/#getOrganizations)
257
257
  #
258
258
  # @example
259
259
  # organizations = client.organizations
@@ -265,7 +265,7 @@ module Bitly
265
265
 
266
266
  ##
267
267
  # Retrieve an organization from the API.
268
- # [`GET /v4/organizations/{organization_guid}`](https://dev.bitly.com/v4/#operation/getOrganization)
268
+ # [`GET /v4/organizations/{organization_guid}`](https://dev.bitly.com/api-reference/#getOrganization)
269
269
  #
270
270
  # @example
271
271
  # organization = client.organization(organization_guid: guid)
@@ -279,7 +279,7 @@ module Bitly
279
279
 
280
280
  ##
281
281
  # Shorten counts by organization
282
- # [`GET /v4/organizations/{organization_guid}/shorten_counts`](https://dev.bitly.com/v4/#operation/getOrganizationShortenCounts)
282
+ # [`GET /v4/organizations/{organization_guid}/shorten_counts`](https://dev.bitly.com/api-reference/#getOrganizationShortenCounts)
283
283
  #
284
284
  # @example
285
285
  # shorten_counts = client.organization_shorten_counts(organization_guid: organization_guid)
@@ -294,7 +294,7 @@ module Bitly
294
294
 
295
295
  ##
296
296
  # Gets the authorized user from the API.
297
- # [`GET /v4/user`](https://dev.bitly.com/v4/#operation/getUser)
297
+ # [`GET /v4/user`](https://dev.bitly.com/api-reference/#getUser)
298
298
  #
299
299
  # @example
300
300
  # user = client.user
@@ -306,7 +306,7 @@ module Bitly
306
306
 
307
307
  ##
308
308
  # Allows you to update the authorized user's name or default group guid.
309
- # [`PATCH /v4/user`](https://dev.bitly.com/v4/#operation/updateUser)]
309
+ # [`PATCH /v4/user`](https://dev.bitly.com/api-reference/#updateUser)]
310
310
  #
311
311
  # @example
312
312
  # client.update_user(name: "New Name", default_group_guid: "aaabbb")
@@ -322,7 +322,7 @@ module Bitly
322
322
 
323
323
  ##
324
324
  # Lists groups the authorized user can see.
325
- # [`GET /v4/groups`](https://dev.bitly.com/v4/#operation/getGroups)
325
+ # [`GET /v4/groups`](https://dev.bitly.com/api-reference/#getGroups)
326
326
  #
327
327
  # @example
328
328
  # groups = client.groups
@@ -337,7 +337,7 @@ module Bitly
337
337
 
338
338
  ##
339
339
  # Fetch a particular group.
340
- # [`GET /v4/groups/{group_guid}`](https://dev.bitly.com/v4/#operation/getGroup)
340
+ # [`GET /v4/groups/{group_guid}`](https://dev.bitly.com/api-reference/#getGroup)
341
341
  #
342
342
  # @example
343
343
  # group = client.group(guid)
@@ -351,7 +351,7 @@ module Bitly
351
351
 
352
352
  ##
353
353
  # Fetch the shorten counts for a group.
354
- # [`GET /v4/groups/{group_guid}/shorten_counts`](https://dev.bitly.com/v4/#operation/getGroupShortenCounts)
354
+ # [`GET /v4/groups/{group_guid}/shorten_counts`](https://dev.bitly.com/api-reference/#getGroupShortenCounts)
355
355
  #
356
356
  # @example
357
357
  # shorten_counts = client.group_shorten_counts(guid: group_guid)
@@ -366,7 +366,7 @@ module Bitly
366
366
 
367
367
  ##
368
368
  # Fetch a group's preferences.
369
- # [`GET /v4/groups/{group_guid}/preferences`](https://dev.bitly.com/v4/#operation/getGroupPreferences)
369
+ # [`GET /v4/groups/{group_guid}/preferences`](https://dev.bitly.com/api-reference/#getGroupPreferences)
370
370
  #
371
371
  # @param group_guid [String] The group's guid
372
372
  #
@@ -377,7 +377,7 @@ module Bitly
377
377
 
378
378
  ##
379
379
  # Update a group's preferences.
380
- # [`PATCH /v4/groups/{group_guid}/preferences`](https://dev.bitly.com/v4/#operation/updateGroupPreferences)
380
+ # [`PATCH /v4/groups/{group_guid}/preferences`](https://dev.bitly.com/api-reference/#updateGroupPreferences)
381
381
  #
382
382
  # @param group_guid [String] The group's guid
383
383
  # @param domain_preference [String] The new domain preference for this
@@ -391,7 +391,7 @@ module Bitly
391
391
 
392
392
  ##
393
393
  # Allows you to update a group's name, organization or BSDs.
394
- # [`PATCH /v4/groups/{group_guid}`](https://dev.bitly.com/v4/#operation/updateGroup)
394
+ # [`PATCH /v4/groups/{group_guid}`](https://dev.bitly.com/api-reference/#updateGroup)
395
395
  #
396
396
  # @example
397
397
  # client.update_group(group_guid: group_guid, name: "New Name", organization_guid: "aaabbb")
@@ -413,7 +413,7 @@ module Bitly
413
413
 
414
414
  ##
415
415
  # Retrieve a list of bitlinks by group
416
- # [`GET /v4/groups/{group_guid}/bitlinks`](https://dev.bitly.com/v4/#operation/getBitlinksByGroup)
416
+ # [`GET /v4/groups/{group_guid}/bitlinks`](https://dev.bitly.com/api-reference/#getBitlinksByGroup)
417
417
  #
418
418
  # @example
419
419
  # bitlinks = client.group_bitlinks(group_guid: guid)
@@ -484,22 +484,9 @@ module Bitly
484
484
  )
485
485
  end
486
486
 
487
- ##
488
- # Deletes a group.
489
- # [`DELETE /v4/groups/{group_guid}`](https://dev.bitly.com/v4/#operation/deleteGroup)
490
- #
491
- # @example
492
- # client.delete_group(group_guid: group_guid)
493
- #
494
- # @return [Nil]
495
- def delete_group(group_guid:)
496
- group = Group.new(data: { "guid" => group_guid }, client: self)
497
- group.delete
498
- end
499
-
500
487
  ##
501
488
  # Gets the referring networks for the group.
502
- # [`GET /v4/groups/{group_guid}/referring_networks`](https://dev.bitly.com/v4/#operation/GetGroupMetricsByReferringNetworks)
489
+ # [`GET /v4/groups/{group_guid}/referring_networks`](https://dev.bitly.com/api-reference/#GetGroupMetricsByReferringNetworks)
503
490
  #
504
491
  # @param group_guid [String] The guid of the group
505
492
  # @param unit [String] A unit of time. Default is "day" and can be
@@ -525,7 +512,7 @@ module Bitly
525
512
 
526
513
  ##
527
514
  # Gets the country click metrics for the group.
528
- # [`GET /v4/groups/{group_guid}/countries`](https://dev.bitly.com/v4/#operation/getGroupMetricsByCountries)
515
+ # [`GET /v4/groups/{group_guid}/countries`](https://dev.bitly.com/api-reference/#getGroupMetricsByCountries)
529
516
  #
530
517
  # @param group_guid [String] The guid of the group
531
518
  # @param unit [String] A unit of time. Default is "day" and can be
@@ -551,7 +538,7 @@ module Bitly
551
538
 
552
539
  ##
553
540
  # Fetch Branded Short Domains (BSDs).
554
- # [`GET /v4/bsds`](https://dev.bitly.com/v4/#operation/getBSDs)
541
+ # [`GET /v4/bsds`](https://dev.bitly.com/api-reference/#getBSDs)
555
542
  #
556
543
  # @example
557
544
  # bsds = client.bsds
@@ -561,18 +548,6 @@ module Bitly
561
548
  BSD.list(client: self)
562
549
  end
563
550
 
564
- ##
565
- # Fetch OAuth application by client ID
566
- # [`GET /v4/apps/{client_id}`)](https://dev.bitly.com/v4/#operation/getOAuthApp)
567
- #
568
- # @example
569
- # app = client.oauth_app(client_id: "client_id")
570
- #
571
- # @return Bitly::API::OAuthApp
572
- def oauth_app(client_id:)
573
- OAuthApp.fetch(client: self, client_id: client_id)
574
- end
575
-
576
551
  private
577
552
 
578
553
  def default_headers
@@ -33,7 +33,7 @@ module Bitly
33
33
  ##
34
34
  # Creates a new Bitly::API::Group::Preferences object from the data,
35
35
  # API client and optional response.
36
- # [`GET /v4/groups/{group_guid}/preferences`](https://dev.bitly.com/v4/#operation/getGroupPreferences)
36
+ # [`GET /v4/groups/{group_guid}/preferences`](https://dev.bitly.com/api-reference/#updateGroupPreferences)
37
37
  #
38
38
  # @example
39
39
  # preferences = Bitly::API::Group::Preferences.new(data: data, client: client)
@@ -49,7 +49,7 @@ module Bitly
49
49
 
50
50
  ##
51
51
  # Updates the preferences via the API
52
- # [`PATCH /v4/groups/{group_guid}/preferences`](https://dev.bitly.com/v4/#operation/updateGroupPreferences)
52
+ # [`PATCH /v4/groups/{group_guid}/preferences`](https://dev.bitly.com/api-reference/#updateGroupPreferences)
53
53
  #
54
54
  # @example
55
55
  # preferences.update(domain_preference: 'bit.ly')
@@ -21,7 +21,7 @@ module Bitly
21
21
  # Get a list of groups from the API. It receives an authorized
22
22
  # `Bitly::API::Client` object and uses it to request the `/groups`
23
23
  # endpoint, optionally passing an organization guid.
24
- # [`GET /v4/groups`](https://dev.bitly.com/v4/#operation/getGroups)
24
+ # [`GET /v4/groups`](https://dev.bitly.com/api-reference/#getGroups)
25
25
  #
26
26
  # @example
27
27
  # groups = Bitly::API::Group.list(client: client)
@@ -44,7 +44,7 @@ module Bitly
44
44
  # Retrieve a group from the API. It receives an authorized
45
45
  # `Bitly::API::Client` object and a group guid and uses it to request
46
46
  # the `/groups/:group_guid` endpoint.
47
- # [`GET /v4/groups/{group_guid}`](https://dev.bitly.com/v4/#operation/getGroup)
47
+ # [`GET /v4/groups/{group_guid}`](https://dev.bitly.com/api-reference/#getGroup)
48
48
  #
49
49
  # @example
50
50
  # group = Bitly::API::Group.fetch(client: client, guid: guid)
@@ -93,7 +93,7 @@ module Bitly
93
93
 
94
94
  ##
95
95
  # Fetch the organization for the group.
96
- # [`GET /v4/organizations/{organization_guid}`)](https://dev.bitly.com/v4/#operation/getOrganization)
96
+ # [`GET /v4/organizations/{organization_guid}`)](https://dev.bitly.com/api-reference/#getOrganization)
97
97
  #
98
98
  # @return [Bitly::API::Organization]
99
99
  def organization
@@ -102,7 +102,7 @@ module Bitly
102
102
 
103
103
  ##
104
104
  # Fetch the group's preferences.
105
- # [`GET /v4/groups/{group_guid}/preferences`](https://dev.bitly.com/v4/#operation/getGroupPreferences)
105
+ # [`GET /v4/groups/{group_guid}/preferences`](https://dev.bitly.com/api-reference/#getGroupPreferences)
106
106
  #
107
107
  # @return [Bitly::API::Group::Preferences]
108
108
  def preferences
@@ -111,7 +111,7 @@ module Bitly
111
111
 
112
112
  ##
113
113
  # Fetch the group's tags
114
- # [`GET /v4/groups/{group_guid}/tags`](https://dev.bitly.com/v4/#operation/getGroupTags)
114
+ # [`GET /v4/groups/{group_guid}/tags`](https://dev.bitly.com/api-reference/#getGroupTags)
115
115
  #
116
116
  # @return [Array<String>]
117
117
  def tags
@@ -123,7 +123,7 @@ module Bitly
123
123
  # If you update the organization guid and have already loaded the
124
124
  # organization, it is nilled out so it can be reloaded with the correct
125
125
  # guid
126
- # [`PATCH /v4/groups/{group_guid}`](https://dev.bitly.com/v4/#operation/updateGroup)
126
+ # [`PATCH /v4/groups/{group_guid}`](https://dev.bitly.com/api-reference/#updateGroup)
127
127
  #
128
128
  # @example
129
129
  # group.update(name: "New Name", organization_guid: "aaabbb")
@@ -147,22 +147,9 @@ module Bitly
147
147
  self
148
148
  end
149
149
 
150
- ##
151
- # Deletes the group.
152
- # [`DELETE /v4/groups/{group_guid}`](https://dev.bitly.com/v4/#operation/deleteGroup)
153
- #
154
- # @example
155
- # group.delete
156
- #
157
- # @return [Nil]
158
- def delete
159
- @response = @client.request(path: "/groups/#{guid}", method: "DELETE")
160
- return nil
161
- end
162
-
163
150
  ##
164
151
  # Get the shorten counts for the group.
165
- # # [`GET /v4/groups/{group_guid}/shorten_counts`](https://dev.bitly.com/v4/#operation/getGroupShortenCounts)
152
+ # # [`GET /v4/groups/{group_guid}/shorten_counts`](https://dev.bitly.com/api-reference/#getGroupShortenCounts)
166
153
  #
167
154
  # @return [Bitly::API::ShortenCounts]
168
155
  def shorten_counts
@@ -171,7 +158,7 @@ module Bitly
171
158
 
172
159
  ##
173
160
  # Gets the Bitlinks for the group.
174
- # [`GET /v4/groups/{group_guid}/bitlinks`](https://dev.bitly.com/v4/#operation/getBitlinksByGroup)
161
+ # [`GET /v4/groups/{group_guid}/bitlinks`](https://dev.bitly.com/api-reference/#getBitlinksByGroup)
175
162
  #
176
163
  # @return [Bitly::API::Bitlink::List]
177
164
  def bitlinks
@@ -180,7 +167,7 @@ module Bitly
180
167
 
181
168
  ##
182
169
  # Gets the referring networks for the group.
183
- # [`GET /v4/groups/{group_guid}/referring_networks`](https://dev.bitly.com/v4/#operation/GetGroupMetricsByReferringNetworks)
170
+ # [`GET /v4/groups/{group_guid}/referring_networks`](https://dev.bitly.com/api-reference/#GetGroupMetricsByReferringNetworks)
184
171
  #
185
172
  # @param unit [String] A unit of time. Default is "day" and can be
186
173
  # "minute", "hour", "day", "week" or "month"
@@ -205,7 +192,7 @@ module Bitly
205
192
 
206
193
  ##
207
194
  # Gets the country click metrics for the group.
208
- # [`GET /v4/groups/{group_guid}/countries`](https://dev.bitly.com/v4/#operation/getGroupMetricsByCountries)
195
+ # [`GET /v4/groups/{group_guid}/countries`](https://dev.bitly.com/api-reference/#getGroupMetricsByCountries)
209
196
  #
210
197
  # @param unit [String] A unit of time. Default is "day" and can be
211
198
  # "minute", "hour", "day", "week" or "month"
@@ -18,7 +18,7 @@ module Bitly
18
18
  # Get a list of organizations from the API. It receives an authorized
19
19
  # `Bitly::API::Client` object and uses it to request the `/organizations`
20
20
  # endpoint.
21
- # [`GET /v4/organizations`](https://dev.bitly.com/v4/#operation/getOrganizations)
21
+ # [`GET /v4/organizations`](https://dev.bitly.com/api-reference/#getOrganizations)
22
22
  #
23
23
  # @example
24
24
  # organizations = Bitly::API::Organization.list(client: client)
@@ -38,7 +38,7 @@ module Bitly
38
38
  # Retrieve an organization from the API. It receives an authorized
39
39
  # `Bitly::API::Client` object and an organization guid and uses it to
40
40
  # request the `/organizations/:organization_guid` endpoint.
41
- # [`GET /v4/organizations/{organization_guid}`](https://dev.bitly.com/v4/#operation/getOrganization)
41
+ # [`GET /v4/organizations/{organization_guid}`](https://dev.bitly.com/api-reference/#getOrganization)
42
42
  #
43
43
  # @example
44
44
  # organization = Bitly::API::Organization.fetch(client: client, organization_guid: guid)
@@ -90,7 +90,7 @@ module Bitly
90
90
 
91
91
  ##
92
92
  # Shorten counts by organization
93
- # [`GET /v4/organizations/{organization_guid}/shorten_counts`](https://dev.bitly.com/v4/#operation/getOrganizationShortenCounts)
93
+ # [`GET /v4/organizations/{organization_guid}/shorten_counts`](https://dev.bitly.com/api-reference/#getOrganizationShortenCounts)
94
94
  #
95
95
  # @example
96
96
  # shorten_counts = organization.shorten_counts
@@ -17,7 +17,7 @@ module Bitly
17
17
 
18
18
  ##
19
19
  # Shorten counts by group
20
- # [`GET /v4/groups/{group_guid}/shorten_counts`](https://dev.bitly.com/v4/#operation/getGroupShortenCounts)
20
+ # [`GET /v4/groups/{group_guid}/shorten_counts`](https://dev.bitly.com/api-reference/#getGroupShortenCounts)
21
21
  #
22
22
  # @example
23
23
  # shorten_counts = Bitly::API::ShortenCounts.by_group(client: client, group_guid: group_guid)
@@ -34,7 +34,7 @@ module Bitly
34
34
 
35
35
  ##
36
36
  # Shorten counts by organization
37
- # [`GET /v4/organizations/{organization_guid}/shorten_counts`](https://dev.bitly.com/v4/#operation/getOrganizationShortenCounts)
37
+ # [`GET /v4/organizations/{organization_guid}/shorten_counts`](https://dev.bitly.com/api-reference/#getOrganizationShortenCounts)
38
38
  #
39
39
  # @example
40
40
  # shorten_counts = Bitly::API::ShortenCounts.by_organization(client: client, organization_guid: organization_guid)
@@ -18,7 +18,7 @@ module Bitly
18
18
  include Base
19
19
  ##
20
20
  # Gets the authorized user from the API.
21
- # [`GET /v4/user`](https://dev.bitly.com/v4/#operation/getUser)
21
+ # [`GET /v4/user`](https://dev.bitly.com/api-reference/#getUser)
22
22
  #
23
23
  # @example
24
24
  # user = Bitly::API::User.fetch(client: client)
@@ -79,7 +79,7 @@ module Bitly
79
79
  # Allows you to update the authorized user's name or default group guid.
80
80
  # If you update the default group ID and have already loaded the default
81
81
  # group, it is nilled out so it can be reloaded with the correct ID.
82
- # [`PATCH /v4/user`](https://dev.bitly.com/v4/#operation/updateUser)]
82
+ # [`PATCH /v4/user`](https://dev.bitly.com/api-reference/#updateUser).
83
83
  #
84
84
  # @example
85
85
  # user.update(name: "New Name", default_group_guid: "aaabbb")
data/lib/bitly/api.rb CHANGED
@@ -13,7 +13,6 @@ module Bitly
13
13
  autoload :Group, File.join(File.dirname(__FILE__), "api/group.rb")
14
14
  autoload :User, File.join(File.dirname(__FILE__), "api/user.rb")
15
15
  autoload :BSD, File.join(File.dirname(__FILE__), "api/bsd.rb")
16
- autoload :OAuthApp, File.join(File.dirname(__FILE__), "api/oauth_app.rb")
17
16
  autoload :ShortenCounts, File.join(File.dirname(__FILE__), "api/shorten_counts.rb")
18
17
  end
19
18
  end
@@ -6,8 +6,18 @@ module Bitly
6
6
  module HTTP
7
7
  module Adapters
8
8
  class NetHTTP
9
+ DEFAULT_OPTS = { use_ssl: true }
10
+
11
+ def initialize(proxy_addr: nil, proxy_port: nil, proxy_user: nil, proxy_pass: nil, request_opts: {})
12
+ @request_opts = DEFAULT_OPTS.merge(request_opts)
13
+ @proxy_addr = proxy_addr
14
+ @proxy_port = proxy_port
15
+ @proxy_user = proxy_user
16
+ @proxy_pass = proxy_pass
17
+ end
18
+
9
19
  def request(request)
10
- Net::HTTP.start(request.uri.host, request.uri.port, use_ssl: true) do |http|
20
+ Net::HTTP.start(request.uri.host, request.uri.port, @proxy_addr, @proxy_port, @proxy_user, @proxy_pass, @request_opts) do |http|
11
21
  method = Object.const_get("Net::HTTP::#{request.method.capitalize}")
12
22
  full_path = request.uri.path
13
23
  full_path += "?#{request.uri.query}" if request.uri.query
data/lib/bitly/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitly
4
- VERSION = "2.1.0"
4
+ VERSION = "3.0.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitly
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Nash
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-21 00:00:00.000000000 Z
11
+ date: 2022-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oauth2
@@ -178,7 +178,6 @@ files:
178
178
  - lib/bitly/api/group.rb
179
179
  - lib/bitly/api/group/preferences.rb
180
180
  - lib/bitly/api/list.rb
181
- - lib/bitly/api/oauth_app.rb
182
181
  - lib/bitly/api/organization.rb
183
182
  - lib/bitly/api/shorten_counts.rb
184
183
  - lib/bitly/api/user.rb
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
- require_relative "./base"
3
-
4
- module Bitly
5
- module API
6
- class OAuthApp
7
- include Base
8
-
9
- def self.attributes
10
- [:name, :description, :link, :client_id]
11
- end
12
- attr_reader(*attributes)
13
-
14
- def self.fetch(client:, client_id:)
15
- response = client.request(path: "/apps/#{client_id}")
16
- new(data: response.body, client: client, response: response)
17
- end
18
-
19
- def initialize(data:, client:, response: nil)
20
- assign_attributes(data)
21
- @client = client
22
- @response = response
23
- end
24
- end
25
- end
26
- end