bitly 1.1.1 → 2.0.1

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.
Files changed (69) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +36 -3
  3. data/.rspec +3 -0
  4. data/.travis.yml +6 -2
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +5 -2
  7. data/History.txt +32 -1
  8. data/LICENSE.md +1 -1
  9. data/README.md +151 -58
  10. data/Rakefile +6 -9
  11. data/bitly.gemspec +36 -32
  12. data/config/env.yml.example +5 -0
  13. data/lib/bitly.rb +9 -7
  14. data/lib/bitly/api.rb +19 -0
  15. data/lib/bitly/api/base.rb +23 -0
  16. data/lib/bitly/api/bitlink.rb +342 -0
  17. data/lib/bitly/api/bitlink/clicks_summary.rb +35 -0
  18. data/lib/bitly/api/bitlink/deeplink.rb +29 -0
  19. data/lib/bitly/api/bitlink/link_click.rb +75 -0
  20. data/lib/bitly/api/bitlink/paginated_list.rb +52 -0
  21. data/lib/bitly/api/bsd.rb +24 -0
  22. data/lib/bitly/api/click_metric.rb +186 -0
  23. data/lib/bitly/api/client.rb +588 -0
  24. data/lib/bitly/api/group.rb +232 -0
  25. data/lib/bitly/api/group/preferences.rb +73 -0
  26. data/lib/bitly/api/list.rb +22 -0
  27. data/lib/bitly/api/oauth_app.rb +26 -0
  28. data/lib/bitly/api/organization.rb +104 -0
  29. data/lib/bitly/api/shorten_counts.rb +61 -0
  30. data/lib/bitly/api/user.rb +107 -0
  31. data/lib/bitly/error.rb +33 -0
  32. data/lib/bitly/http.rb +10 -0
  33. data/lib/bitly/http/adapters.rb +9 -0
  34. data/lib/bitly/http/adapters/net_http.rb +27 -0
  35. data/lib/bitly/http/client.rb +33 -0
  36. data/lib/bitly/http/request.rb +118 -0
  37. data/lib/bitly/http/response.rb +66 -0
  38. data/lib/bitly/oauth.rb +109 -0
  39. data/lib/bitly/version.rb +3 -1
  40. metadata +82 -111
  41. data/Manifest +0 -37
  42. data/lib/bitly/client.rb +0 -145
  43. data/lib/bitly/config.rb +0 -29
  44. data/lib/bitly/url.rb +0 -103
  45. data/lib/bitly/utils.rb +0 -57
  46. data/lib/bitly/v3.rb +0 -14
  47. data/lib/bitly/v3/bitly.rb +0 -7
  48. data/lib/bitly/v3/client.rb +0 -207
  49. data/lib/bitly/v3/country.rb +0 -13
  50. data/lib/bitly/v3/day.rb +0 -13
  51. data/lib/bitly/v3/missing_url.rb +0 -15
  52. data/lib/bitly/v3/oauth.rb +0 -41
  53. data/lib/bitly/v3/realtime_link.rb +0 -18
  54. data/lib/bitly/v3/referrer.rb +0 -13
  55. data/lib/bitly/v3/url.rb +0 -154
  56. data/lib/bitly/v3/user.rb +0 -135
  57. data/test/bitly/test_client.rb +0 -266
  58. data/test/bitly/test_config.rb +0 -28
  59. data/test/bitly/test_url.rb +0 -167
  60. data/test/bitly/test_utils.rb +0 -79
  61. data/test/fixtures/cnn.json +0 -1
  62. data/test/fixtures/cnn_and_google.json +0 -1
  63. data/test/fixtures/expand_cnn.json +0 -1
  64. data/test/fixtures/expand_cnn_and_google.json +0 -1
  65. data/test/fixtures/google_and_cnn_info.json +0 -1
  66. data/test/fixtures/google_info.json +0 -1
  67. data/test/fixtures/google_stats.json +0 -1
  68. data/test/fixtures/shorten_error.json +0 -1
  69. data/test/test_helper.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: '087fb2a63ecc1d2528e91cc06d415921f30d5358'
4
- data.tar.gz: 2b1d6c00ebc719756e84574bf054bd390027c4b5
2
+ SHA256:
3
+ metadata.gz: 33a5d90e877bdac9ea6991afe188e198302be52327b36dd4ee7fc99970b23b2d
4
+ data.tar.gz: 46dd90271942653821d355f3c670237593f492f7d9a3c57562c2057189b332ff
5
5
  SHA512:
6
- metadata.gz: 2c0c174a4c3e6249f35d1b5204639d4e0747a76702b01f0e8cda9c6d27f4e63abf533bfb5bf0afea80ac596455a4f890fe24c23d3d42dcf63dd1837ca4b2f960
7
- data.tar.gz: 330100602a53d6b381c3383814450ccb1edc84d7006fa7520ade4a0bf55b8404da0d1ea2bf925e63bcbdd4ad7bb6ab0a94fdd29e721201cadaceda095570744b
6
+ metadata.gz: 8ddc083e1ad6b75fb88772688e70c8d9d65c221d6d8744f637ba05cd8b5b00fbf864847ba4b29d61e2f904e1315d0f3086b0f6e3338fc3d6d20ef5e13c769bc1
7
+ data.tar.gz: 249edc58187a0c701e8fbc337e80aaa89361b3115816394b48e22a194070a7f472a382ebbabc1bcb964cffac9abd4300b4e2b006b8cf7ed14a505f0ac634301e
data/.gitignore CHANGED
@@ -1,3 +1,36 @@
1
- pkg
2
- doc
3
- Gemfile.lock
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ ## Documentation cache and generated files:
14
+ /.yardoc/
15
+ /_yardoc/
16
+ /doc/
17
+ /rdoc/
18
+
19
+ ## Environment normalization:
20
+ /.bundle/
21
+ /vendor/bundle
22
+ /lib/bundler/man/
23
+
24
+ # for a library or gem, you might want to ignore these files since the code is
25
+ # intended to run in multiple environments; otherwise, check them in:
26
+ Gemfile.lock
27
+ .ruby-version
28
+
29
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
30
+ .rvmrc
31
+
32
+ # Don't check in credentials
33
+ config/env.yml
34
+ ]
35
+
36
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -1,11 +1,15 @@
1
1
  language: ruby
2
2
  sudo: required
3
3
  dist: trusty
4
+ before_install:
5
+ - gem update --system
6
+ - gem install bundler
4
7
  rvm:
8
+ - 2.7
9
+ - 2.6
10
+ - 2.5
5
11
  - 2.4
6
12
  - 2.3
7
- - 2.2
8
- - 2.1
9
13
  - ruby-head
10
14
  - jruby-19mode
11
15
  - jruby-head
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at philnash@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,3 +1,6 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
- gemspec
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in bitly.gemspec
6
+ gemspec
@@ -1,7 +1,38 @@
1
1
  === Ongoing
2
2
 
3
- * updates
3
+ ...
4
4
 
5
+ === 2.0.1 / 2020-06-18
6
+
7
+ * Fixes sending parameters in ClicksSummary (thanks @CodingFu)
8
+
9
+ === 2.0.0 / 2020-03-12
10
+
11
+ * Complete overhaul of the gem
12
+ * Supports version 4 of the Bitly API
13
+ * See the README and documentation for more details
14
+
15
+ === 2.0.0.beta.2 / 2020-03-02
16
+
17
+ * Uses autoload to improve memory consumption
18
+
19
+ === 2.0.0.beta.1 / 2020-02-15
20
+
21
+ * Complete overhaul of the gem
22
+ * Supports version 4 of the Bitly API
23
+
24
+ === 1.1.2
25
+
26
+ * 2 minor updates
27
+
28
+ * Fix for obtaining clicks for branded subdomains
29
+ * Some fixes for Ruby compiler warnings
30
+
31
+ === 1.1.1
32
+
33
+ * 3 minor updates
34
+
35
+ * Updates shoulda/activesupport versions in dev dependencies
5
36
  * Removes development dependency on Echoe and tidies up gemspec
6
37
  * Adds license to gemspec
7
38
 
data/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016 Phil Nash
1
+ Copyright (c) 2018 Phil Nash
2
2
 
3
3
  ### MIT License
4
4
 
data/README.md CHANGED
@@ -1,93 +1,186 @@
1
- # bitly
1
+ # Bitly
2
+
3
+ A Ruby gem for using the version 4 [Bitly API](https://dev.bitly.com/) to shorten links, expand short links and view metrics across users, links and organizations.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/bitly.svg)](https://rubygems.org/gems/bitly) [![Build Status](https://travis-ci.org/philnash/bitly.svg?branch=master)](https://travis-ci.org/philnash/bitly) [![Maintainability](https://api.codeclimate.com/v1/badges/f8e078b468c1f2aeca53/maintainability)](https://codeclimate.com/github/philnash/bitly/maintainability) [![Inline docs](https://inch-ci.org/github/philnash/bitly.svg?branch=master)](https://inch-ci.org/github/philnash/bitly)
6
+
7
+ * [Installation](#installation)
8
+ * [Usage](#usage)
9
+ * [Authentication](#authentication)
10
+ * [Creating an API client](#creating-an-api-client)
11
+ * [Shorten a link](#shorten-a-link)
12
+ * [Expand a link](#expand-a-link)
13
+ * [Available API Endpoints](#available-api-endpoints)
14
+ * [Groups](#groups)
15
+ * [Organizations](#organizations)
16
+ * [Users](#users)
17
+ * [Bitlinks](#bitlinks)
18
+ * [Custom Bitlinks](#custom-bitlinks)
19
+ * [Campaigns](#campaigns)
20
+ * [BSDs (Branded Short Domains)](#bsds-branded-short-domains)
21
+ * [OAuth Apps](#oauth-apps)
22
+ * [Development](#development)
23
+ * [Contributing](#contributing)
24
+ * [License](#license)
25
+ * [Code of Conduct](#code-of-conduct)
26
+
27
+ ## Installation
28
+
29
+ Add this line to your application's Gemfile:
2
30
 
3
- ## DESCRIPTION:
31
+ ```ruby
32
+ gem 'bitly'
33
+ ```
4
34
 
5
- A Ruby API for [http://bitly.com](http://bitly.com)
35
+ And then execute:
6
36
 
7
- [http://dev.bitly.com](http://dev.bitly.com)
37
+ ```bash
38
+ $ bundle install
39
+ ```
8
40
 
9
- [![Build Status](https://travis-ci.org/philnash/bitly.svg?branch=master)](https://travis-ci.org/philnash/bitly)
41
+ Or install it yourself as:
10
42
 
11
- ## NOTE:
43
+ ```bash
44
+ $ gem install bitly
45
+ ```
12
46
 
13
- Bitly recently released their version 3 API. From this 0.5.0 release, the gem will continue to work the same but also provide a V3 module, using the version 3 API. The standard module will become deprecated, as Bitly do not plan to keep the version 2 API around forever.
47
+ ## Usage
14
48
 
15
- To move to using the version 3 API, call:
49
+ ### Authentication
16
50
 
17
- ```ruby
18
- Bitly.use_api_version_3
19
- ```
51
+ All API endpoints require authentication with an OAuth token. You can get your own OAuth token from the [Bitly console](https://app.bitly.com/). Click on the account drop down menu, then _Profile Settings_ then _Generic Access Token_. Fill in your password and you can generate an OAuth access token.
20
52
 
21
- Then, when you call ``Bitly.new(username, api_key)`` you will get a ``Bitly::V3::Client`` instead, which provides the version 3 api calls (``shorten``, ``expand``, ``clicks``, ``validate`` and ``bitly_pro_domain``). See [http://dev.bitly.com](http://dev.bitly.com) for details.
53
+ For other methods to generate access tokens for users via OAuth flows, see the [Authentication documentation](docs/authentication.md).
22
54
 
23
- Eventually, this will become the default version used and finally, the V3 module will disappear, with the version 3 classes replacing the version 2 classes.
55
+ Once you have an access token you can use all the API methods.
24
56
 
25
- (Please excuse the lack of tests for the v3 classes, they are fully tested and ready to replace this whole codebase in the v3 branch of the GitHub repo, until I realized it would break everything.)
57
+ ### Creating an API client
26
58
 
27
- ## INSTALLATION:
59
+ All API methods are available through the `Bitly::API::Client`. Initialise the client with the access token like so:
28
60
 
29
- gem install bitly
61
+ ```ruby
62
+ client = Bitly::API::Client.new(token: token)
63
+ ```
30
64
 
31
- ## USAGE:
65
+ You can then use the client to perform actions with the API
32
66
 
33
- ### Version 2 API
67
+ ### Shorten a link
34
68
 
35
- Create a Bitly client using your username and api key as follows:
69
+ With an authenticated client you can shorten a link like so:
36
70
 
37
71
  ```ruby
38
- bitly = Bitly.new(username, api_key)
72
+ bitlink = client.shorten(long_url: "http://example.com")
73
+ bitlink.link
74
+ # => http://bit.ly/2OUJim0
39
75
  ```
40
76
 
41
- You can then use that client to shorten or expand urls or return more information or statistics as so:
77
+ ### Expand a link
78
+
79
+ With an authorised you can expand any Bitlink.
42
80
 
43
81
  ```ruby
44
- bitly.shorten('http://www.google.com')
45
- bitly.shorten('http://www.google.com', :history => 1) # adds the url to the api user's history
46
- bitly.expand('wQaT')
47
- bitly.info('http://bit.ly/wQaT')
48
- bitly.stats('http://bit.ly/wQaT')
82
+ bitlink = client.expand(bitlink: "bit.ly/2OUJim0")
83
+ bitlink.long_url
84
+ # => http://example.com
49
85
  ```
50
86
 
51
- Each can be used in all the methods described in the API docs, the shorten function, for example, takes a url or an array of urls.
87
+ ## Available API Endpoints
52
88
 
53
- All four functions return a ``Bitly::Url`` object (or an array of ``Bitly::Url`` objects if you supplied an array as the input). You can then get all the information required from that object.
89
+ This gem supports the following active v4 API endpoints for the[Bitly API](https://dev.bitly.com/v4_documentation.html).
54
90
 
55
- ```ruby
56
- u = bitly.shorten('http://www.google.com') #=> Bitly::Url
57
-
58
- u.long_url #=> "http://www.google.com"
59
- u.short_url #=> "http://bit.ly/Ywd1"
60
- u.bitly_url #=> "http://bit.ly/Ywd1"
61
- u.jmp_url #=> "http://j.mp/Ywd1"
62
- u.user_hash #=> "Ywd1"
63
- u.hash #=> "2V6CFi"
64
- u.info #=> a ruby hash of the JSON returned from the API
65
- u.stats #=> a ruby hash of the JSON returned from the API
66
-
67
- bitly.shorten('http://www.google.com', 'keyword')
68
- ```
91
+ ### Groups
69
92
 
70
- ### Version 3 API
93
+ [Groups documentation](docs/groups.md)
71
94
 
72
- Please see the Bit.ly API documentation [http://api.bit.ly](http://api.bit.ly) for details on the V3 API.
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)
73
107
 
74
- Get your access token here: [https://bitly.com/a/oauth_apps](https://bitly.com/a/oauth_apps).
108
+ ### Organizations
75
109
 
76
- ### Configure bitly through initializer
110
+ [Organizations documentation](docs/organizations.md)
77
111
 
78
- If you want to configure bitly through an initializer (e.g. `config/initializers/bitly.rb`), do the following:
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)
79
115
 
80
- ```ruby
81
- Bitly.use_api_version_3
116
+ ### Users
82
117
 
83
- Bitly.configure do |config|
84
- config.api_version = 3
85
- config.access_token = "API_KEY"
86
- end
87
- ```
118
+ [Users documentation](docs/users.md)
88
119
 
89
- Instead of using `Bitly.new(username, api_key)` to get the client, use `Bitly.client`:
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)
90
122
 
91
- ```ruby
92
- Bitly.client.shorten('http://www.google.com')
93
- ```
123
+ ### Bitlinks
124
+
125
+ [Bitlinks documentation](docs/bitlinks.md)
126
+
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)
139
+
140
+ ### Custom Bitlinks
141
+
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)
146
+
147
+ ### Campaigns
148
+
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)
157
+
158
+ ### BSDs (Branded Short Domains)
159
+
160
+ [Branded Short Domains documentation](docs/branded_short_domains.md)
161
+
162
+ - [x] [Retrieve BSDs (`GET /v4/bsds`)](https://dev.bitly.com/v4/#operation/getBSDs)
163
+
164
+ ### OAuth Apps
165
+
166
+ [OAuth Apps documentation](docs/oauth_apps.md)
167
+
168
+ - [x] [Retrieve OAuth App (`GET /v4/apps/{client_id}`)](https://dev.bitly.com/v4/#operation/getOAuthApp)
169
+
170
+ ## Development
171
+
172
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
173
+
174
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
175
+
176
+ ## Contributing
177
+
178
+ Bug reports and pull requests are welcome on GitHub at https://github.com/philnash/bitly. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
179
+
180
+ ## License
181
+
182
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
183
+
184
+ ## Code of Conduct
185
+
186
+ Everyone interacting in the Bitly project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/philnash/bitly/blob/master/CODE_OF_CONDUCT.md).