bitly_quickly 0.0.3 → 0.0.4
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 +4 -4
- data/.travis.yml +19 -0
- data/README.md +9 -0
- data/bitly_quickly.gemspec +0 -1
- data/lib/bitly_quickly/version.rb +1 -1
- data/spec/request_stubs.rb +37 -0
- data/spec/spec_helper.rb +3 -38
- metadata +4 -16
- data/Rakefile +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e67efff2c50fdd060829833683d1a6c5ac27cd0
|
4
|
+
data.tar.gz: 142fe6f00a88cae85c77eab9da6b1a3b4d5dd759
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0df43a8e345ad56d5a559b3e346f7b82ddfdf7c60a7c89d9879fa5048d20034caf2cdfb3f51a8491e294be9ab7fc33d0deb9955d0761a8688bf175fc0ae2c70d
|
7
|
+
data.tar.gz: 05f8ec93196e05bac5a646e226364a4f259c2fa95e897eb90e216aef53927156c5fdeac76d039776732cbe68353b22cc7f8a4d27fb13902af9418149ef7e288b
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
# BitlyQuickly
|
2
2
|
|
3
|
+
[](https://travis-ci.org/ollie/bitly_quickly)
|
4
|
+
|
3
5
|
There are many great [bit.ly](https://bitly.com/) gems, it's just that I wanted something as fast and as simple as possible.
|
4
6
|
It can only shorten URLs. :-)
|
5
7
|
|
6
8
|
It uses [Typhoeus](https://github.com/typhoeus/typhoeus) which is an awesome HTTP library for fast
|
7
9
|
and parallel networking. It also uses [Oj](https://github.com/ohler55/oj) which is a fast JSON parser.
|
8
10
|
|
11
|
+
## Tested on
|
12
|
+
|
13
|
+
* 2.1.1
|
14
|
+
* 2.1.0
|
15
|
+
* 2.0.0
|
16
|
+
* 1.9.3
|
17
|
+
|
9
18
|
## Installation
|
10
19
|
|
11
20
|
Add this line to your application's Gemfile:
|
data/bitly_quickly.gemspec
CHANGED
@@ -19,7 +19,6 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
22
|
-
spec.add_development_dependency 'rake', '~> 10.1'
|
23
22
|
spec.add_development_dependency 'rspec', '~> 2.14'
|
24
23
|
spec.add_development_dependency 'webmock', '~> 1.17'
|
25
24
|
spec.add_development_dependency 'simplecov', '~> 0.8'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
1.upto(5) do |n|
|
2
|
+
WebMock.stub_request(:get, %(https://api-ssl.bitly.com/v3/shorten?access_token=valid_token&longUrl=http://example.org/200/#{ n })).
|
3
|
+
to_return(
|
4
|
+
status: 200,
|
5
|
+
body: %({ "status_code": 200, "status_txt": "OK", "data": { "long_url": "http:\/\/example.org\/200\/#{ n }", "url": "http:\/\/pht.io\/1eyUhF#{ n }", "hash": "1eyUhFo", "global_hash": "2V6CFi", "new_hash": 0 } })
|
6
|
+
)
|
7
|
+
end
|
8
|
+
|
9
|
+
WebMock.stub_request(:get, 'https://api-ssl.bitly.com/v3/shorten?access_token=token&longUrl=http://example.org/403').
|
10
|
+
to_return(
|
11
|
+
status: 200,
|
12
|
+
body: '{ "data": null, "status_code": 403, "status_txt": "RATE_LIMIT_EXCEEDED" }'
|
13
|
+
)
|
14
|
+
|
15
|
+
WebMock.stub_request(:get, 'https://api-ssl.bitly.com/v3/shorten?access_token=token&longUrl=http://example.org/404').
|
16
|
+
to_return(
|
17
|
+
status: 200,
|
18
|
+
body: '{ "data": null, "status_code": 404, "status_txt": "NOT_FOUND" }'
|
19
|
+
)
|
20
|
+
|
21
|
+
WebMock.stub_request(:get, 'https://api-ssl.bitly.com/v3/shorten?access_token=token&longUrl=http://example.org/500').
|
22
|
+
to_return(
|
23
|
+
status: 200,
|
24
|
+
body: '{ "data": null, "status_code": 500, "status_txt": "INVALID_URI" }'
|
25
|
+
)
|
26
|
+
|
27
|
+
WebMock.stub_request(:get, 'https://api-ssl.bitly.com/v3/shorten?access_token=token&longUrl=http://example.org/503').
|
28
|
+
to_return(
|
29
|
+
status: 200,
|
30
|
+
body: '{ "data": null, "status_code": 503, "status_txt": "UNKNOWN_ERROR" }'
|
31
|
+
)
|
32
|
+
|
33
|
+
WebMock.stub_request(:get, 'https://api-ssl.bitly.com/v3/shorten?access_token=token&longUrl=http://example.org/666').
|
34
|
+
to_return(
|
35
|
+
status: 200,
|
36
|
+
body: '{ "data": null, "status_code": 666, "status_txt": "WHO_KNOWS" }'
|
37
|
+
)
|
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
|
1
3
|
require 'simplecov'
|
2
4
|
require 'webmock' # Disable all HTTP access
|
3
5
|
|
@@ -6,42 +8,5 @@ SimpleCov.start do
|
|
6
8
|
add_filter '/spec/' # Ignore spec directory
|
7
9
|
end
|
8
10
|
|
11
|
+
require 'request_stubs'
|
9
12
|
require 'bitly_quickly'
|
10
|
-
|
11
|
-
1.upto(5) do |n|
|
12
|
-
WebMock.stub_request(:get, %(https://api-ssl.bitly.com/v3/shorten?access_token=valid_token&longUrl=http://example.org/200/#{ n })).
|
13
|
-
to_return(
|
14
|
-
status: 200,
|
15
|
-
body: %({ "status_code": 200, "status_txt": "OK", "data": { "long_url": "http:\/\/example.org\/200\/#{ n }", "url": "http:\/\/pht.io\/1eyUhF#{ n }", "hash": "1eyUhFo", "global_hash": "2V6CFi", "new_hash": 0 } })
|
16
|
-
)
|
17
|
-
end
|
18
|
-
|
19
|
-
WebMock.stub_request(:get, 'https://api-ssl.bitly.com/v3/shorten?access_token=token&longUrl=http://example.org/403').
|
20
|
-
to_return(
|
21
|
-
status: 200,
|
22
|
-
body: '{ "data": null, "status_code": 403, "status_txt": "RATE_LIMIT_EXCEEDED" }'
|
23
|
-
)
|
24
|
-
|
25
|
-
WebMock.stub_request(:get, 'https://api-ssl.bitly.com/v3/shorten?access_token=token&longUrl=http://example.org/404').
|
26
|
-
to_return(
|
27
|
-
status: 200,
|
28
|
-
body: '{ "data": null, "status_code": 404, "status_txt": "NOT_FOUND" }'
|
29
|
-
)
|
30
|
-
|
31
|
-
WebMock.stub_request(:get, 'https://api-ssl.bitly.com/v3/shorten?access_token=token&longUrl=http://example.org/500').
|
32
|
-
to_return(
|
33
|
-
status: 200,
|
34
|
-
body: '{ "data": null, "status_code": 500, "status_txt": "INVALID_URI" }'
|
35
|
-
)
|
36
|
-
|
37
|
-
WebMock.stub_request(:get, 'https://api-ssl.bitly.com/v3/shorten?access_token=token&longUrl=http://example.org/503').
|
38
|
-
to_return(
|
39
|
-
status: 200,
|
40
|
-
body: '{ "data": null, "status_code": 503, "status_txt": "UNKNOWN_ERROR" }'
|
41
|
-
)
|
42
|
-
|
43
|
-
WebMock.stub_request(:get, 'https://api-ssl.bitly.com/v3/shorten?access_token=token&longUrl=http://example.org/666').
|
44
|
-
to_return(
|
45
|
-
status: 200,
|
46
|
-
body: '{ "data": null, "status_code": 666, "status_txt": "WHO_KNOWS" }'
|
47
|
-
)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bitly_quickly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oldrich Vetesnik
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.5'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '10.1'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '10.1'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rspec
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,14 +103,15 @@ extra_rdoc_files: []
|
|
117
103
|
files:
|
118
104
|
- ".gitignore"
|
119
105
|
- ".rspec"
|
106
|
+
- ".travis.yml"
|
120
107
|
- Gemfile
|
121
108
|
- LICENSE.txt
|
122
109
|
- README.md
|
123
|
-
- Rakefile
|
124
110
|
- bitly_quickly.gemspec
|
125
111
|
- lib/bitly_quickly.rb
|
126
112
|
- lib/bitly_quickly/version.rb
|
127
113
|
- spec/lib/bitly_quickly_spec.rb
|
114
|
+
- spec/request_stubs.rb
|
128
115
|
- spec/spec_helper.rb
|
129
116
|
homepage: https://github.com/ollie/bitly_quickly
|
130
117
|
licenses:
|
@@ -152,5 +139,6 @@ specification_version: 4
|
|
152
139
|
summary: Shorten URLs with bit.ly API
|
153
140
|
test_files:
|
154
141
|
- spec/lib/bitly_quickly_spec.rb
|
142
|
+
- spec/request_stubs.rb
|
155
143
|
- spec/spec_helper.rb
|
156
144
|
has_rdoc:
|