bitly 1.1.2 → 2.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +36 -3
  3. data/.rspec +3 -0
  4. data/.travis.yml +5 -2
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +5 -2
  7. data/History.txt +18 -1
  8. data/LICENSE.md +1 -1
  9. data/README.md +151 -58
  10. data/Rakefile +4 -9
  11. data/bin/console +14 -0
  12. data/bin/oauth +10 -0
  13. data/bin/setup +8 -0
  14. data/bitly.gemspec +24 -29
  15. data/config/env.yml.example +5 -0
  16. data/docs/authentication.md +51 -0
  17. data/docs/bitlinks.md +2 -0
  18. data/docs/branded_short_domains.md +20 -0
  19. data/docs/groups.md +80 -0
  20. data/docs/oauth_apps.md +20 -0
  21. data/docs/organizations.md +74 -0
  22. data/docs/premium_apis.md +0 -0
  23. data/docs/users.md +1 -0
  24. data/lib/bitly.rb +6 -7
  25. data/lib/bitly/api.rb +16 -0
  26. data/lib/bitly/api/base.rb +22 -0
  27. data/lib/bitly/api/bitlink.rb +341 -0
  28. data/lib/bitly/api/bitlink/clicks_summary.rb +35 -0
  29. data/lib/bitly/api/bitlink/deeplink.rb +29 -0
  30. data/lib/bitly/api/bitlink/link_click.rb +74 -0
  31. data/lib/bitly/api/bitlink/paginated_list.rb +51 -0
  32. data/lib/bitly/api/bsd.rb +24 -0
  33. data/lib/bitly/api/click_metric.rb +185 -0
  34. data/lib/bitly/api/client.rb +588 -0
  35. data/lib/bitly/api/group.rb +232 -0
  36. data/lib/bitly/api/group/preferences.rb +73 -0
  37. data/lib/bitly/api/list.rb +22 -0
  38. data/lib/bitly/api/oauth_app.rb +26 -0
  39. data/lib/bitly/api/organization.rb +104 -0
  40. data/lib/bitly/api/shorten_counts.rb +61 -0
  41. data/lib/bitly/api/user.rb +107 -0
  42. data/lib/bitly/error.rb +33 -0
  43. data/lib/bitly/http.rb +6 -0
  44. data/lib/bitly/http/adapters/net_http.rb +27 -0
  45. data/lib/bitly/http/client.rb +33 -0
  46. data/lib/bitly/http/request.rb +116 -0
  47. data/lib/bitly/http/response.rb +65 -0
  48. data/lib/bitly/oauth.rb +109 -0
  49. data/lib/bitly/version.rb +3 -1
  50. metadata +88 -108
  51. data/Manifest +0 -37
  52. data/lib/bitly/url.rb +0 -103
  53. data/lib/bitly/utils.rb +0 -57
  54. data/lib/bitly/v3.rb +0 -14
  55. data/lib/bitly/v3/bitly.rb +0 -7
  56. data/lib/bitly/v3/country.rb +0 -13
  57. data/lib/bitly/v3/day.rb +0 -13
  58. data/lib/bitly/v3/missing_url.rb +0 -15
  59. data/lib/bitly/v3/oauth.rb +0 -41
  60. data/lib/bitly/v3/realtime_link.rb +0 -18
  61. data/lib/bitly/v3/referrer.rb +0 -13
  62. data/lib/bitly/v3/url.rb +0 -154
  63. data/test/bitly/test_client.rb +0 -266
  64. data/test/bitly/test_config.rb +0 -28
  65. data/test/bitly/test_url.rb +0 -167
  66. data/test/bitly/test_utils.rb +0 -79
  67. data/test/fixtures/cnn.json +0 -1
  68. data/test/fixtures/cnn_and_google.json +0 -1
  69. data/test/fixtures/expand_cnn.json +0 -1
  70. data/test/fixtures/expand_cnn_and_google.json +0 -1
  71. data/test/fixtures/google_and_cnn_info.json +0 -1
  72. data/test/fixtures/google_info.json +0 -1
  73. data/test/fixtures/google_stats.json +0 -1
  74. data/test/fixtures/shorten_error.json +0 -1
  75. data/test/test_helper.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6a8801e0af73bf65ac762477c11eab29bf2fb3fe
4
- data.tar.gz: 654ce50db6081aa03e871ebfc3cfb7db1c529d2a
2
+ SHA256:
3
+ metadata.gz: 9f5ea77a3cf31565edfd92df7f3e5295e0921592d46ab2c6a82544c1bdc3b9aa
4
+ data.tar.gz: 64a22df3165af72fd65954fb70d3af7e04c5e743d52bcc1c94dbb57a8b8c97ea
5
5
  SHA512:
6
- metadata.gz: eeba81429fdfc4d65107890ae8bb0f6c5c17b924256bfb19d9640ed08aa38fd06ad1d9e4ea42a0a9e29c51b10a2c8b166232fe375767168a974ecbc29b1d2176
7
- data.tar.gz: d3b5f93048e1d511a7449a7c647c9d1ed44d9e14e54cd62fcd36f6b7cd739c66414a0ff61b5a42a1602981cbeeb1d6ce6d1e2be82296a2e6e05ba61307455ef4
6
+ metadata.gz: a30418e79a7c1af67a7b2ab3c98fd21c385fcb6ac690a0a704755e0c5b037da5175c27ef8d1c6ea8d1baa59836e607dfc72416f60178e1781ae203e6056bd4dd
7
+ data.tar.gz: 4db248dccaf1ef70932ccf1ff3264b22da25d3cc2d0f8c168e6b857afc7ec365ed044ec72d797a513d4349fc3dd0a3294d082291cb9d9947e95c6d2d4a069393
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,14 @@
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
5
10
  - 2.5
6
11
  - 2.4
7
- - 2.3
8
- - 2.2
9
12
  - ruby-head
10
13
  - jruby-19mode
11
14
  - 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,24 @@
1
1
  === Ongoing
2
2
 
3
- * updates
3
+ ...
4
4
 
5
+ === 2.0.0.beta.1 / 2020-02-15
6
+
7
+ * Complete overhaul of the gem.
8
+ * Supports version 4 of the Bitly API
9
+
10
+ === 1.1.2
11
+
12
+ * 2 minor updates
13
+
14
+ * Fix for obtaining clicks for branded subdomains
15
+ * Some fixes for Ruby compiler warnings
16
+
17
+ === 1.1.1
18
+
19
+ * 3 minor updates
20
+
21
+ * Updates shoulda/activesupport versions in dev dependencies
5
22
  * Removes development dependency on Echoe and tidies up gemspec
6
23
  * Adds license to gemspec
7
24
 
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).
data/Rakefile CHANGED
@@ -1,11 +1,6 @@
1
- require 'bundler/gem_tasks'
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
2
3
 
3
- require 'rake/testtask'
4
- task :default => [:test]
4
+ RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- desc 'Run tests (default)'
7
- Rake::TestTask.new(:test) do |t|
8
- t.test_files = FileList['test/**/test_*.rb']
9
- t.ruby_opts = ['-Itest']
10
- t.ruby_opts << '-r rubygems' if defined? Gem
11
- end
6
+ task :default => :spec