ruby-bitly 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/CHANGELOG +10 -1
- data/Gemfile +2 -2
- data/Gemfile.lock +59 -38
- data/README.rdoc +67 -19
- data/bin/bitly +4 -4
- data/fixtures/vcr_cassettes/expand_a_long_url_should_result_an_error.yml +36 -27
- data/fixtures/vcr_cassettes/expand_a_short_url_to_it_long_url.yml +37 -27
- data/fixtures/vcr_cassettes/get_clicks_by_short_url.yml +33 -23
- data/fixtures/vcr_cassettes/shorten_bitly_url.yml +35 -26
- data/fixtures/vcr_cassettes/shorten_long_url.yml +34 -24
- data/fixtures/vcr_cassettes/shorten_long_url_with_preferred_domain.yml +46 -0
- data/lib/ruby-bitly.rb +79 -6
- data/lib/ruby-bitly/version.rb +1 -1
- data/ruby-bitly.gemspec +8 -8
- data/spec/ruby-bitly_spec.rb +87 -34
- data/spec/spec_helper.rb +3 -4
- metadata +35 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff50be2b324d891776449f31237b35f8d95aa265
|
4
|
+
data.tar.gz: c99ae534047471483cc3585e2d7dc35d6b5793d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f6f11d961827a80b1d76f32e8432d7b2aa773e9db87ea6cb8a64ba691ea7c768ec3f9b107150d53d148c551f16773e13ff4f6b788b864a42b032a7944f809ac
|
7
|
+
data.tar.gz: c2e528bc64410d3611886f326475c3c5b99bffc124343d90fbece352e5acf76af3a89160ed35440827e8e359dc318b23fc81a95c2cf55a017fa57e4138c0c259
|
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in ruby-bitly.gemspec
|
4
4
|
gemspec
|
@@ -10,7 +10,7 @@ group :development, :test do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
platforms :ruby_19, :ruby_20 do
|
13
|
-
gem 'debugger'
|
13
|
+
gem 'debugger', '1.6.5'
|
14
14
|
end
|
15
15
|
|
16
16
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,58 +1,79 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ruby-bitly (0.1.
|
5
|
-
|
6
|
-
rest-client (~> 1.6)
|
4
|
+
ruby-bitly (0.1.7)
|
5
|
+
rest-client (~> 2.0)
|
7
6
|
|
8
7
|
GEM
|
9
|
-
remote:
|
8
|
+
remote: https://rubygems.org/
|
10
9
|
specs:
|
11
|
-
addressable (2.
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
addressable (2.4.0)
|
11
|
+
byebug (9.0.6)
|
12
|
+
columnize (0.9.0)
|
13
|
+
crack (0.4.3)
|
14
|
+
safe_yaml (~> 1.0.0)
|
15
|
+
debugger (1.6.5)
|
15
16
|
columnize (>= 0.3.1)
|
16
|
-
debugger-linecache (~> 1.
|
17
|
-
debugger-ruby_core_source (~> 1.
|
18
|
-
debugger-linecache (1.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
17
|
+
debugger-linecache (~> 1.2.0)
|
18
|
+
debugger-ruby_core_source (~> 1.3.1)
|
19
|
+
debugger-linecache (1.2.0)
|
20
|
+
debugger-ruby_core_source (1.3.8)
|
21
|
+
diff-lcs (1.2.5)
|
22
|
+
domain_name (0.5.20160826)
|
23
|
+
unf (>= 0.0.5, < 1.0.0)
|
24
|
+
hashdiff (0.3.0)
|
25
|
+
http-cookie (1.0.3)
|
26
|
+
domain_name (~> 0.5)
|
27
|
+
linecache (1.3.1)
|
28
|
+
mime-types (3.1)
|
29
|
+
mime-types-data (~> 3.2015)
|
30
|
+
mime-types-data (3.2016.0521)
|
31
|
+
netrc (0.11.0)
|
32
|
+
rake (11.3.0)
|
33
|
+
rest-client (2.0.0)
|
34
|
+
http-cookie (>= 1.0.2, < 2.0)
|
35
|
+
mime-types (>= 1.16, < 4.0)
|
36
|
+
netrc (~> 0.8)
|
37
|
+
rspec (3.5.0)
|
38
|
+
rspec-core (~> 3.5.0)
|
39
|
+
rspec-expectations (~> 3.5.0)
|
40
|
+
rspec-mocks (~> 3.5.0)
|
41
|
+
rspec-core (3.5.4)
|
42
|
+
rspec-support (~> 3.5.0)
|
43
|
+
rspec-expectations (3.5.0)
|
44
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
+
rspec-support (~> 3.5.0)
|
46
|
+
rspec-mocks (3.5.0)
|
47
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
48
|
+
rspec-support (~> 3.5.0)
|
49
|
+
rspec-support (3.5.0)
|
38
50
|
ruby-debug (0.10.4)
|
39
51
|
columnize (>= 0.1)
|
40
52
|
ruby-debug-base (~> 0.10.4.0)
|
41
53
|
ruby-debug-base (0.10.4)
|
42
54
|
linecache (>= 0.3)
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
55
|
+
safe_yaml (1.0.4)
|
56
|
+
unf (0.1.4)
|
57
|
+
unf_ext
|
58
|
+
unf_ext (0.0.7.2)
|
59
|
+
vcr (3.0.3)
|
60
|
+
webmock (2.1.0)
|
61
|
+
addressable (>= 2.3.6)
|
62
|
+
crack (>= 0.3.2)
|
63
|
+
hashdiff
|
47
64
|
|
48
65
|
PLATFORMS
|
49
66
|
ruby
|
50
67
|
|
51
68
|
DEPENDENCIES
|
52
|
-
|
69
|
+
byebug
|
70
|
+
debugger (= 1.6.5)
|
53
71
|
rake
|
54
|
-
rspec (~>
|
72
|
+
rspec (~> 3.5)
|
55
73
|
ruby-bitly!
|
56
74
|
ruby-debug
|
57
|
-
vcr (~>
|
58
|
-
webmock (~> 1
|
75
|
+
vcr (~> 3.0)
|
76
|
+
webmock (~> 2.1)
|
77
|
+
|
78
|
+
BUNDLED WITH
|
79
|
+
1.13.1
|
data/README.rdoc
CHANGED
@@ -1,22 +1,67 @@
|
|
1
1
|
= A simple bit.ly ruby client.
|
2
2
|
|
3
|
-
|
3
|
+
{<img src="https://codeclimate.com/github/dx7/ruby-bitly/badges/gpa.svg" />}[https://codeclimate.com/github/dx7/ruby-bitly]
|
4
|
+
|
5
|
+
|
6
|
+
== Shorten
|
4
7
|
require 'ruby-bitly'
|
5
8
|
|
6
|
-
|
9
|
+
# old way (deprecated)
|
10
|
+
bitly = Bitly.shorten("https://dx7.github.io/", "login-here", "key-here")
|
7
11
|
|
8
|
-
|
12
|
+
# new way
|
13
|
+
bitly = Bitly.shorten(long_url: "https://dx7.github.io/", login: "login-here", api_key: "key-here")
|
14
|
+
|
15
|
+
bitly.url #=> "http://bit.ly/2dAjjfo"
|
9
16
|
|
10
17
|
y bitly
|
11
|
-
:long_url: http://
|
12
|
-
:url: http://bit.ly/
|
13
|
-
:hash:
|
18
|
+
:long_url: http://dx7.github.io/
|
19
|
+
:url: http://bit.ly/2dAjjfo
|
20
|
+
:hash: 2dAjjfo
|
14
21
|
:global_hash: micSj7
|
15
22
|
:new_hash: 0
|
16
|
-
:hash_path:
|
23
|
+
:hash_path: 2dAjjfo
|
17
24
|
:status_code: 200
|
18
25
|
:status_txt: OK
|
19
26
|
|
27
|
+
|
28
|
+
== Expand
|
29
|
+
require 'ruby-bitly'
|
30
|
+
|
31
|
+
# old way (deprecated)
|
32
|
+
bitly = Bitly.expand("http://bit.ly/2dAjjfo", "login-here", "key-here")
|
33
|
+
|
34
|
+
# new way
|
35
|
+
bitly = Bitly.expand(short_url: "http://bit.ly/2dAjjfo", login: "login-here", api_key: "key-here")
|
36
|
+
|
37
|
+
y bitly
|
38
|
+
:short_url: http://bit.ly/2dAjjfo
|
39
|
+
:long_url: https://dx7.github.io/
|
40
|
+
:user_hash: 2dAjjfo
|
41
|
+
:global_hash: 2dAkyet
|
42
|
+
:status_code: 200
|
43
|
+
:status_txt: OK
|
44
|
+
|
45
|
+
|
46
|
+
== Get Clicks
|
47
|
+
require 'ruby-bitly'
|
48
|
+
|
49
|
+
# old way (deprecated)
|
50
|
+
bitly = Bitly.get_clicks("http://bit.ly/2dAjjfo", "login-here", "key-here")
|
51
|
+
|
52
|
+
# new way
|
53
|
+
bitly = Bitly.get_clicks(short_url: "http://bit.ly/2dAjjfo", login: "login-here", api_key: "key-here")
|
54
|
+
|
55
|
+
y bitly
|
56
|
+
:short_url: https://bit.ly/2dAjjfo
|
57
|
+
:global_hash: 2dAkyet
|
58
|
+
:user_clicks: 0
|
59
|
+
:user_hash: 2dAjjfo
|
60
|
+
:global_clicks: 0
|
61
|
+
:status_code: 200
|
62
|
+
:status_txt: OK
|
63
|
+
|
64
|
+
|
20
65
|
== Command Line Examples
|
21
66
|
Usage
|
22
67
|
bitly [options] url
|
@@ -24,14 +69,14 @@
|
|
24
69
|
For help: bitly -h
|
25
70
|
|
26
71
|
Basic examples:
|
27
|
-
bitly -s http://
|
28
|
-
bitly -e http://bit.ly/
|
29
|
-
bitly --user-clicks http://bit.ly/
|
30
|
-
bitly --global-clicks http://bit.ly/
|
72
|
+
bitly -s http://dx7.github.io
|
73
|
+
bitly -e http://bit.ly/2dAjjfo
|
74
|
+
bitly --user-clicks http://bit.ly/2dAjjfo
|
75
|
+
bitly --global-clicks http://bit.ly/2dAjjfo
|
31
76
|
|
32
77
|
Other examples:
|
33
|
-
bitly -q -s http://
|
34
|
-
bitly --verbose -e http://bit.ly/
|
78
|
+
bitly -q -s http://dx7.github.io
|
79
|
+
bitly --verbose -e http://bit.ly/2dAjjfo
|
35
80
|
|
36
81
|
Options
|
37
82
|
-s, --shorten Shorten a long url (default option)
|
@@ -47,22 +92,25 @@
|
|
47
92
|
-q, --quiet Output as little as possible, overrides verbose
|
48
93
|
-V, --verbose Verbose output
|
49
94
|
|
95
|
+
|
50
96
|
=== Authentication
|
51
|
-
bit.ly API
|
97
|
+
bit.ly API requires authentication credentials.
|
52
98
|
|
53
|
-
|
99
|
+
You need a free bit.ly user account and apiKey. Signup at: http://bit.ly/a/sign_up
|
54
100
|
If you already have an account, you can find your apiKey at: http://bit.ly/a/your_api_key
|
55
101
|
|
56
|
-
You can supply credentials as parameters.
|
57
|
-
bitly -l <username> -k <key-here> -s http://
|
102
|
+
You can supply credentials as parameters. For example:
|
103
|
+
bitly -l <username> -k <key-here> -s http://dx7.github.io
|
58
104
|
|
59
105
|
Or you can create the file ~/.bitly (YAML format) with this content:
|
60
106
|
login: <username>
|
61
107
|
key: <key-here>
|
62
108
|
|
109
|
+
|
63
110
|
== Author
|
64
|
-
|
111
|
+
dx7 ~ dx7(a)protonmail.ch
|
112
|
+
|
65
113
|
|
66
114
|
== Copyright
|
67
|
-
Copyright (c) 2010
|
115
|
+
Copyright (c) 2010 dx7. Licensed under the MIT License:
|
68
116
|
http://www.opensource.org/licenses/mit-license.php
|
data/bin/bitly
CHANGED
@@ -128,10 +128,10 @@ class App
|
|
128
128
|
end
|
129
129
|
|
130
130
|
def process_command
|
131
|
-
return Bitly.shorten(arguments.first, options.login, options.key).url if options.shorten
|
132
|
-
return Bitly.expand(arguments.first, options.login, options.key).long_url if options.expand
|
133
|
-
return Bitly.get_clicks(arguments.first, options.login, options.key).user_clicks.to_s if options.user_clicks
|
134
|
-
return Bitly.get_clicks(arguments.first, options.login, options.key).global_clicks.to_s if options.global_clicks
|
131
|
+
return Bitly.shorten(:long_url => arguments.first, :login => options.login, :api_key => options.key).url if options.shorten
|
132
|
+
return Bitly.expand(:short_url => arguments.first, :login => options.login, :api_key => options.key).long_url if options.expand
|
133
|
+
return Bitly.get_clicks(:short_url => arguments.first, :login => options.login, :api_key => options.key).user_clicks.to_s if options.user_clicks
|
134
|
+
return Bitly.get_clicks(:short_url => arguments.first, :login => options.login, :api_key => options.key).global_clicks.to_s if options.global_clicks
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
@@ -1,36 +1,45 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: http://api.bit.ly
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api.bit.ly/v3/expand
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: shortURL=http%3A%2F%2Fgoogle.com&login=my-login&apiKey=my-api-key
|
9
|
+
headers:
|
10
|
+
Accept:
|
9
11
|
- "*/*; q=0.5, application/xml"
|
10
|
-
|
12
|
+
Accept-Encoding:
|
11
13
|
- gzip, deflate
|
12
|
-
|
13
|
-
-
|
14
|
-
|
14
|
+
Content-Length:
|
15
|
+
- '90'
|
16
|
+
Content-Type:
|
15
17
|
- application/x-www-form-urlencoded
|
16
|
-
|
17
|
-
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
18
22
|
code: 200
|
19
23
|
message: OK
|
20
|
-
headers:
|
21
|
-
|
24
|
+
headers:
|
25
|
+
Server:
|
22
26
|
- nginx
|
23
|
-
|
24
|
-
- Sat,
|
25
|
-
|
27
|
+
Date:
|
28
|
+
- Sat, 01 Oct 2016 19:29:26 GMT
|
29
|
+
Content-Type:
|
26
30
|
- application/json; charset=utf-8
|
27
|
-
|
31
|
+
Content-Length:
|
32
|
+
- '131'
|
33
|
+
Connection:
|
28
34
|
- keep-alive
|
29
|
-
|
30
|
-
-
|
31
|
-
|
32
|
-
-
|
33
|
-
|
34
|
-
|
35
|
+
Mime-Version:
|
36
|
+
- '1.0'
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{ "status_code": 200, "status_txt": "OK", "data": { "expand": [ { "error":
|
40
|
+
"NOT_FOUND", "short_url": "http:\/\/google.com" } ] } }
|
35
41
|
|
36
|
-
|
42
|
+
'
|
43
|
+
http_version:
|
44
|
+
recorded_at: Sat, 01 Oct 2016 19:29:26 GMT
|
45
|
+
recorded_with: VCR 3.0.3
|
@@ -1,36 +1,46 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: http://api.bit.ly
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api.bit.ly/v3/expand
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: shortURL=http%3A%2F%2Fbit.ly%2FbcvNe5&login=my-login&apiKey=my-api-key
|
9
|
+
headers:
|
10
|
+
Accept:
|
9
11
|
- "*/*; q=0.5, application/xml"
|
10
|
-
|
12
|
+
Accept-Encoding:
|
11
13
|
- gzip, deflate
|
12
|
-
|
13
|
-
-
|
14
|
-
|
14
|
+
Content-Length:
|
15
|
+
- '95'
|
16
|
+
Content-Type:
|
15
17
|
- application/x-www-form-urlencoded
|
16
|
-
|
17
|
-
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
18
22
|
code: 200
|
19
23
|
message: OK
|
20
|
-
headers:
|
21
|
-
|
24
|
+
headers:
|
25
|
+
Server:
|
22
26
|
- nginx
|
23
|
-
|
24
|
-
- Sat,
|
25
|
-
|
27
|
+
Date:
|
28
|
+
- Sat, 01 Oct 2016 19:29:26 GMT
|
29
|
+
Content-Type:
|
26
30
|
- application/json; charset=utf-8
|
27
|
-
|
31
|
+
Content-Length:
|
32
|
+
- '197'
|
33
|
+
Connection:
|
28
34
|
- keep-alive
|
29
|
-
|
30
|
-
-
|
31
|
-
|
32
|
-
-
|
33
|
-
|
34
|
-
|
35
|
+
Mime-Version:
|
36
|
+
- '1.0'
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{ "status_code": 200, "status_txt": "OK", "data": { "expand": [ { "short_url":
|
40
|
+
"http:\/\/bit.ly\/bcvNe5", "long_url": "http:\/\/google.com", "user_hash":
|
41
|
+
"bcvNe5", "global_hash": "zzzzzzz" } ] } }
|
35
42
|
|
36
|
-
|
43
|
+
'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Sat, 01 Oct 2016 19:29:26 GMT
|
46
|
+
recorded_with: VCR 3.0.3
|
@@ -1,30 +1,40 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: http://api.bit.ly
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: http://api.bit.ly/v3/clicks?apiKey=my-api-key&login=my-login&shortUrl=http://bit.ly/xlii42
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
Accept:
|
9
11
|
- "*/*; q=0.5, application/xml"
|
10
|
-
|
12
|
+
Accept-Encoding:
|
11
13
|
- gzip, deflate
|
12
|
-
|
13
|
-
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
response:
|
17
|
+
status:
|
14
18
|
code: 200
|
15
19
|
message: OK
|
16
|
-
headers:
|
17
|
-
|
20
|
+
headers:
|
21
|
+
Server:
|
18
22
|
- nginx
|
19
|
-
|
20
|
-
- Sat,
|
21
|
-
|
23
|
+
Date:
|
24
|
+
- Sat, 01 Oct 2016 19:29:27 GMT
|
25
|
+
Content-Type:
|
22
26
|
- application/json; charset=utf-8
|
23
|
-
|
27
|
+
Content-Length:
|
28
|
+
- '187'
|
29
|
+
Connection:
|
24
30
|
- keep-alive
|
25
|
-
|
26
|
-
- "
|
27
|
-
|
28
|
-
-
|
29
|
-
|
30
|
-
|
31
|
+
Etag:
|
32
|
+
- '"a6d2ce859ab41b205deb5d920fa10e3143a79bf2"'
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: '{"status_code": 200, "data": {"clicks": [{"short_url": "http://bit.ly/xlii42",
|
36
|
+
"global_hash": "cunZEP", "user_clicks": 2, "user_hash": "cT1Izu", "global_clicks":
|
37
|
+
2}]}, "status_txt": "OK"}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Sat, 01 Oct 2016 19:29:27 GMT
|
40
|
+
recorded_with: VCR 3.0.3
|
@@ -1,34 +1,43 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: http://api.bit.ly
|
6
|
-
body:
|
7
|
-
|
8
|
-
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api.bit.ly/v3/shorten
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: longURL=http%3A%2F%2Fbit.ly%2FbcvNe5&login=my-login&apiKey=my-api-key
|
9
|
+
headers:
|
10
|
+
Accept:
|
9
11
|
- "*/*; q=0.5, application/xml"
|
10
|
-
|
12
|
+
Accept-Encoding:
|
11
13
|
- gzip, deflate
|
12
|
-
|
13
|
-
-
|
14
|
-
|
14
|
+
Content-Length:
|
15
|
+
- '94'
|
16
|
+
Content-Type:
|
15
17
|
- application/x-www-form-urlencoded
|
16
|
-
|
17
|
-
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
18
22
|
code: 200
|
19
23
|
message: OK
|
20
|
-
headers:
|
21
|
-
|
24
|
+
headers:
|
25
|
+
Server:
|
22
26
|
- nginx
|
23
|
-
|
24
|
-
- Sat,
|
25
|
-
|
27
|
+
Date:
|
28
|
+
- Sat, 01 Oct 2016 19:29:25 GMT
|
29
|
+
Content-Type:
|
26
30
|
- application/json; charset=utf-8
|
27
|
-
|
31
|
+
Content-Length:
|
32
|
+
- '73'
|
33
|
+
Connection:
|
28
34
|
- keep-alive
|
29
|
-
|
30
|
-
-
|
31
|
-
|
32
|
-
-
|
33
|
-
|
34
|
-
|
35
|
+
Mime-Version:
|
36
|
+
- '1.0'
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{ "data": [ ], "status_code": 500, "status_txt": "ALREADY_A_BITLY_LINK"
|
40
|
+
}'
|
41
|
+
http_version:
|
42
|
+
recorded_at: Sat, 01 Oct 2016 19:29:25 GMT
|
43
|
+
recorded_with: VCR 3.0.3
|
@@ -1,36 +1,46 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
|
4
|
-
method:
|
5
|
-
uri: http://api.bit.ly
|
6
|
-
body:
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api.bit.ly/v3/shorten
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: longURL=http%3A%2F%2Fgoogle.com&login=my-login&apiKey=my-api-key
|
7
9
|
headers:
|
8
|
-
|
10
|
+
Accept:
|
9
11
|
- "*/*; q=0.5, application/xml"
|
10
|
-
|
12
|
+
Accept-Encoding:
|
11
13
|
- gzip, deflate
|
12
|
-
|
13
|
-
-
|
14
|
-
|
14
|
+
Content-Length:
|
15
|
+
- '89'
|
16
|
+
Content-Type:
|
15
17
|
- application/x-www-form-urlencoded
|
16
|
-
|
17
|
-
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
18
22
|
code: 200
|
19
23
|
message: OK
|
20
24
|
headers:
|
21
|
-
|
25
|
+
Server:
|
22
26
|
- nginx
|
23
|
-
|
24
|
-
- Sat,
|
25
|
-
|
27
|
+
Date:
|
28
|
+
- Sat, 01 Oct 2016 19:28:37 GMT
|
29
|
+
Content-Type:
|
26
30
|
- application/json; charset=utf-8
|
27
|
-
|
31
|
+
Content-Length:
|
32
|
+
- '184'
|
33
|
+
Connection:
|
28
34
|
- keep-alive
|
29
|
-
|
30
|
-
-
|
31
|
-
|
32
|
-
-
|
33
|
-
|
34
|
-
|
35
|
+
Mime-Version:
|
36
|
+
- '1.0'
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{ "status_code": 200, "status_txt": "OK", "data": { "long_url": "http:\/\/google.com\/",
|
40
|
+
"url": "http:\/\/bit.ly\/lVW32C", "hash": "lVW32C", "global_hash": "3j4ir4",
|
41
|
+
"new_hash": 0 } }
|
35
42
|
|
36
|
-
|
43
|
+
'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Sat, 01 Oct 2016 19:28:37 GMT
|
46
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,46 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api.bit.ly/v3/shorten
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: longURL=http%3A%2F%2Fgoogle.com&login=my-login&apiKey=my-api-key&domain=j.mp
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*; q=0.5, application/xml"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
Content-Length:
|
15
|
+
- '101'
|
16
|
+
Content-Type:
|
17
|
+
- application/x-www-form-urlencoded
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- nginx
|
27
|
+
Date:
|
28
|
+
- Sat, 01 Oct 2016 19:29:25 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=utf-8
|
31
|
+
Content-Length:
|
32
|
+
- '182'
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
Mime-Version:
|
36
|
+
- '1.0'
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{ "status_code": 200, "status_txt": "OK", "data": { "long_url": "http:\/\/google.com\/",
|
40
|
+
"url": "http:\/\/j.mp\/lVW32C", "hash": "lVW32C", "global_hash": "3j4ir4",
|
41
|
+
"new_hash": 0 } }
|
42
|
+
|
43
|
+
'
|
44
|
+
http_version:
|
45
|
+
recorded_at: Sat, 01 Oct 2016 19:29:25 GMT
|
46
|
+
recorded_with: VCR 3.0.3
|
data/lib/ruby-bitly.rb
CHANGED
@@ -12,8 +12,37 @@ class Bitly < OpenStruct
|
|
12
12
|
class << self
|
13
13
|
attr_accessor :login, :key
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
# Old API:
|
16
|
+
#
|
17
|
+
# shorten(long_url, login = self.login, key = self.key)
|
18
|
+
#
|
19
|
+
# New API:
|
20
|
+
#
|
21
|
+
# shorten(options)
|
22
|
+
#
|
23
|
+
# Options can have:
|
24
|
+
#
|
25
|
+
# :long_url
|
26
|
+
# :login
|
27
|
+
# :api_key
|
28
|
+
# :domain
|
29
|
+
def shorten(long_url, login = self.login, key = self.key)
|
30
|
+
if long_url.is_a?(Hash)
|
31
|
+
options = long_url
|
32
|
+
long_url = options[:long_url]
|
33
|
+
login = options[:login] || self.login
|
34
|
+
key = options[:api_key] || self.key
|
35
|
+
else
|
36
|
+
options = {}
|
37
|
+
end
|
38
|
+
|
39
|
+
params = { :longURL => long_url, :login => login, :apiKey => key }
|
40
|
+
|
41
|
+
if options[:domain]
|
42
|
+
params[:domain] = options[:domain]
|
43
|
+
end
|
44
|
+
|
45
|
+
response = JSON.parse RestClient.post(REST_API_URL + ACTION_PATH[:shorten], params)
|
17
46
|
response.delete("data") if response["data"].empty?
|
18
47
|
|
19
48
|
bitly = new response["data"]
|
@@ -25,8 +54,30 @@ class Bitly < OpenStruct
|
|
25
54
|
bitly
|
26
55
|
end
|
27
56
|
|
28
|
-
|
29
|
-
|
57
|
+
# Old API:
|
58
|
+
#
|
59
|
+
# expand(short_url, login = self.login, key = self.key)
|
60
|
+
#
|
61
|
+
# New API:
|
62
|
+
#
|
63
|
+
# expand(options)
|
64
|
+
#
|
65
|
+
# Options can have:
|
66
|
+
#
|
67
|
+
# :long_url
|
68
|
+
# :login
|
69
|
+
# :api_key
|
70
|
+
def expand(short_url, login = self.login, key = self.key)
|
71
|
+
if short_url.is_a?(Hash)
|
72
|
+
options = short_url
|
73
|
+
short_url = options[:short_url]
|
74
|
+
login = options[:login] || self.login
|
75
|
+
key = options[:api_key] || self.key
|
76
|
+
else
|
77
|
+
options = {}
|
78
|
+
end
|
79
|
+
|
80
|
+
response = JSON.parse RestClient.post(REST_API_URL + ACTION_PATH[:expand], { :shortURL => short_url, :login => login, :apiKey => key })
|
30
81
|
|
31
82
|
bitly = new(response["data"]["expand"].first)
|
32
83
|
bitly.status_code = response["status_code"]
|
@@ -36,8 +87,30 @@ class Bitly < OpenStruct
|
|
36
87
|
bitly
|
37
88
|
end
|
38
89
|
|
39
|
-
|
40
|
-
|
90
|
+
# Old API:
|
91
|
+
#
|
92
|
+
# get_clicks(short_url, login = self.login, key = self.key)
|
93
|
+
#
|
94
|
+
# New API:
|
95
|
+
#
|
96
|
+
# get_clicks(options)
|
97
|
+
#
|
98
|
+
# Options can have:
|
99
|
+
#
|
100
|
+
# :long_url
|
101
|
+
# :login
|
102
|
+
# :api_key
|
103
|
+
def get_clicks(short_url, login = self.login, key = self.key)
|
104
|
+
if short_url.is_a?(Hash)
|
105
|
+
options = short_url
|
106
|
+
short_url = options[:short_url]
|
107
|
+
login = options[:login] || self.login
|
108
|
+
key = options[:api_key] || self.key
|
109
|
+
else
|
110
|
+
options = {}
|
111
|
+
end
|
112
|
+
|
113
|
+
response = JSON.parse RestClient.get("#{REST_API_URL}#{ACTION_PATH[:clicks]}?login=#{login}&apiKey=#{key}&shortUrl=#{short_url}")
|
41
114
|
|
42
115
|
bitly = new(response["data"]["clicks"].first)
|
43
116
|
bitly.status_code = response["status_code"]
|
data/lib/ruby-bitly/version.rb
CHANGED
data/ruby-bitly.gemspec
CHANGED
@@ -5,19 +5,19 @@ require "ruby-bitly/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "ruby-bitly"
|
7
7
|
s.version = BitlyGem::VERSION
|
8
|
-
s.authors = ["
|
9
|
-
s.email = ["
|
10
|
-
s.homepage = "http://github.com/
|
8
|
+
s.authors = ["dx7"]
|
9
|
+
s.email = ["dx7@protonmail.ch"]
|
10
|
+
s.homepage = "http://github.com/dx7/ruby-bitly"
|
11
11
|
s.summary = %q{A simple bit.ly ruby client}
|
12
12
|
s.description = %q{A simple bit.ly ruby client}
|
13
13
|
s.files = `git ls-files`.split("\n")
|
14
14
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
15
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
16
|
s.require_paths = ["lib"]
|
17
|
-
s.add_dependency('rest-client', '~>
|
18
|
-
s.
|
17
|
+
s.add_dependency('rest-client', '~> 2.0')
|
18
|
+
s.add_development_dependency('byebug')
|
19
19
|
s.add_development_dependency('rake')
|
20
|
-
s.add_development_dependency('rspec', '~>
|
21
|
-
s.add_development_dependency('vcr', '~>
|
22
|
-
s.add_development_dependency('webmock', '~> 1
|
20
|
+
s.add_development_dependency('rspec', '~> 3.5')
|
21
|
+
s.add_development_dependency('vcr', '~> 3.0')
|
22
|
+
s.add_development_dependency('webmock', '~> 2.1')
|
23
23
|
end
|
data/spec/ruby-bitly_spec.rb
CHANGED
@@ -1,69 +1,122 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
3
|
+
require 'byebug'
|
3
4
|
|
4
5
|
describe "RubyBitly" do
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
7
|
+
let(:login) { ENV['RUBY_BITLY_LOGIN'] || 'my-login' }
|
8
|
+
let(:key) { ENV['RUBY_BITLY_APIKEY'] || 'my-api-key' }
|
9
|
+
|
10
|
+
it "Shorten long url using old API" do
|
11
|
+
response = VCR.use_cassette('shorten_long_url') do
|
12
|
+
Bitly.shorten("http://google.com", login, key)
|
13
|
+
end
|
14
|
+
|
15
|
+
expect(response.status_txt).to eq("OK")
|
16
|
+
expect(response.status_code).to eq(200)
|
17
|
+
expect(response.new_hash).to eq(0)
|
18
|
+
expect(response.global_hash).not_to be_empty
|
19
|
+
expect(response.hash_path.length).not_to eq(0)
|
20
|
+
expect(response.url).to match(/^http:\/\/bit\.ly\/[A-Za-z0-9]*/)
|
9
21
|
end
|
10
22
|
|
11
|
-
it
|
23
|
+
it 'Shorten long url using options API' do
|
12
24
|
response = VCR.use_cassette('shorten_long_url') do
|
13
|
-
Bitly.shorten("http://google.com",
|
25
|
+
Bitly.shorten(:long_url => "http://google.com", :login => login, :api_key => key)
|
14
26
|
end
|
15
27
|
|
16
|
-
response.
|
17
|
-
response.
|
18
|
-
response.new_hash.
|
19
|
-
response.global_hash.
|
20
|
-
response.hash_path.length.
|
21
|
-
response.url.
|
28
|
+
expect(response.status_txt).to eq("OK")
|
29
|
+
expect(response.status_code).to eq(200)
|
30
|
+
expect(response.new_hash).to eq(0)
|
31
|
+
expect(response.global_hash).not_to be_empty
|
32
|
+
expect(response.hash_path.length).not_to eq(0)
|
33
|
+
expect(response.url).to match(/^http:\/\/bit\.ly\/[A-Za-z0-9]*/)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'Shorten url with a preferred domain' do
|
37
|
+
response = VCR.use_cassette('shorten_long_url_with_preferred_domain') do
|
38
|
+
Bitly.shorten(:long_url => "http://google.com", :domain => 'j.mp',
|
39
|
+
:login => login, :api_key => key)
|
40
|
+
end
|
41
|
+
|
42
|
+
expect(response.status_txt).to eq("OK")
|
43
|
+
expect(response.status_code).to eq(200)
|
44
|
+
expect(response.new_hash).to eq(0)
|
45
|
+
expect(response.global_hash).not_to be_empty
|
46
|
+
expect(response.hash_path.length).not_to eq(0)
|
47
|
+
expect(response.url).to match(/^http:\/\/j\.mp\/[A-Za-z0-9]*/)
|
22
48
|
end
|
23
49
|
|
24
50
|
it "Shorten bitly url" do
|
25
51
|
response = VCR.use_cassette('shorten_bitly_url') do
|
26
|
-
Bitly.shorten("http://bit.ly/bcvNe5",
|
52
|
+
Bitly.shorten("http://bit.ly/bcvNe5", login, key)
|
53
|
+
end
|
54
|
+
|
55
|
+
expect(response.status_txt).to eq("ALREADY_A_BITLY_LINK")
|
56
|
+
expect(response.status_code).to eq(500)
|
57
|
+
end
|
58
|
+
|
59
|
+
it "Expand a short url to it long url using old API" do
|
60
|
+
response = VCR.use_cassette('expand_a_short_url_to_it_long_url') do
|
61
|
+
Bitly.expand("http://bit.ly/bcvNe5", login, key)
|
27
62
|
end
|
28
63
|
|
29
|
-
response.
|
64
|
+
expect(response.status_txt).to eq("OK")
|
65
|
+
expect(response.status_code).to eq(200)
|
66
|
+
expect(response.long_url).to eq("http://google.com")
|
67
|
+
expect(response.short_url).to eq("http://bit.ly/bcvNe5")
|
68
|
+
expect(response.user_hash).to eq("bcvNe5")
|
30
69
|
end
|
31
70
|
|
32
|
-
it "Expand a short url to it long url" do
|
71
|
+
it "Expand a short url to it long url using options API" do
|
33
72
|
response = VCR.use_cassette('expand_a_short_url_to_it_long_url') do
|
34
|
-
Bitly.expand("http://bit.ly/bcvNe5",
|
73
|
+
Bitly.expand({ :short_url => "http://bit.ly/bcvNe5", :login => login, :api_key => key })
|
35
74
|
end
|
36
75
|
|
37
|
-
response.
|
38
|
-
response.
|
39
|
-
response.long_url.
|
40
|
-
response.short_url.
|
41
|
-
response.user_hash.
|
76
|
+
expect(response.status_txt).to eq("OK")
|
77
|
+
expect(response.status_code).to eq(200)
|
78
|
+
expect(response.long_url).to eq("http://google.com")
|
79
|
+
expect(response.short_url).to eq("http://bit.ly/bcvNe5")
|
80
|
+
expect(response.user_hash).to eq("bcvNe5")
|
42
81
|
end
|
43
82
|
|
44
83
|
it "Expand a long url should result an error" do
|
45
84
|
response = VCR.use_cassette('expand_a_long_url_should_result_an_error') do
|
46
|
-
Bitly.expand("http://google.com",
|
85
|
+
Bitly.expand("http://google.com", login, key)
|
47
86
|
end
|
48
87
|
|
49
|
-
response.
|
50
|
-
response.
|
51
|
-
response.long_url.
|
52
|
-
response.short_url.
|
88
|
+
expect(response.status_txt).to eq("OK")
|
89
|
+
expect(response.status_code).to eq(200)
|
90
|
+
expect(response.long_url).to eq("NOT_FOUND")
|
91
|
+
expect(response.short_url).to eq("http://google.com")
|
53
92
|
end
|
54
93
|
|
55
94
|
|
56
|
-
it "Get clicks by short_url" do
|
95
|
+
it "Get clicks by short_url using old API" do
|
96
|
+
bitly = VCR.use_cassette('get_clicks_by_short_url') do
|
97
|
+
Bitly.get_clicks("http://bit.ly/xlii42", login, key)
|
98
|
+
end
|
99
|
+
|
100
|
+
expect(bitly.status_txt).to eq("OK")
|
101
|
+
expect(bitly.status_code).to eq(200)
|
102
|
+
expect(bitly.global_clicks).to be_an_instance_of Fixnum
|
103
|
+
expect(bitly.user_clicks).to be_an_instance_of Fixnum
|
104
|
+
expect(bitly.short_url).to eq("http://bit.ly/xlii42")
|
105
|
+
expect(bitly.global_hash).to eq("cunZEP")
|
106
|
+
expect(bitly.user_hash).to eq("cT1Izu")
|
107
|
+
end
|
108
|
+
|
109
|
+
it "Get clicks by short_url using options API" do
|
57
110
|
bitly = VCR.use_cassette('get_clicks_by_short_url') do
|
58
|
-
Bitly.get_clicks("http://bit.ly/xlii42",
|
111
|
+
Bitly.get_clicks(:short_url => "http://bit.ly/xlii42", :login => login, :api_key => key)
|
59
112
|
end
|
60
113
|
|
61
|
-
bitly.status_txt.
|
62
|
-
bitly.status_code.
|
63
|
-
bitly.global_clicks.
|
64
|
-
bitly.user_clicks.
|
65
|
-
bitly.short_url.
|
66
|
-
bitly.global_hash.
|
67
|
-
bitly.user_hash.
|
114
|
+
expect(bitly.status_txt).to eq("OK")
|
115
|
+
expect(bitly.status_code).to eq(200)
|
116
|
+
expect(bitly.global_clicks).to be_an_instance_of Fixnum
|
117
|
+
expect(bitly.user_clicks).to be_an_instance_of Fixnum
|
118
|
+
expect(bitly.short_url).to eq("http://bit.ly/xlii42")
|
119
|
+
expect(bitly.global_hash).to eq("cunZEP")
|
120
|
+
expect(bitly.user_hash).to eq("cT1Izu")
|
68
121
|
end
|
69
122
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -3,12 +3,11 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
3
3
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
4
|
require 'ruby-bitly'
|
5
5
|
require 'rspec'
|
6
|
-
require 'rspec/autorun'
|
7
6
|
require 'vcr'
|
8
7
|
|
9
|
-
VCR.
|
8
|
+
VCR.configure do |c|
|
10
9
|
c.cassette_library_dir = 'fixtures/vcr_cassettes'
|
11
10
|
c.ignore_localhost = true
|
12
|
-
c.
|
13
|
-
c.default_cassette_options = { :record => :once }
|
11
|
+
c.hook_into :webmock
|
12
|
+
c.default_cassette_options = { :record => :once, :match_requests_on => [:method, :uri, :host, :path, :body, :query] }
|
14
13
|
end
|
metadata
CHANGED
@@ -1,109 +1,109 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-bitly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- dx7
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: byebug
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
-
type: :
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '3.5'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '3.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: vcr
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '3.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '3.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: webmock
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1
|
89
|
+
version: '2.1'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1
|
96
|
+
version: '2.1'
|
97
97
|
description: A simple bit.ly ruby client
|
98
98
|
email:
|
99
|
-
-
|
99
|
+
- dx7@protonmail.ch
|
100
100
|
executables:
|
101
101
|
- bitly
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
-
- .gitignore
|
106
|
-
- .rspec
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rspec"
|
107
107
|
- CHANGELOG
|
108
108
|
- Gemfile
|
109
109
|
- Gemfile.lock
|
@@ -116,12 +116,13 @@ files:
|
|
116
116
|
- fixtures/vcr_cassettes/get_clicks_by_short_url.yml
|
117
117
|
- fixtures/vcr_cassettes/shorten_bitly_url.yml
|
118
118
|
- fixtures/vcr_cassettes/shorten_long_url.yml
|
119
|
+
- fixtures/vcr_cassettes/shorten_long_url_with_preferred_domain.yml
|
119
120
|
- lib/ruby-bitly.rb
|
120
121
|
- lib/ruby-bitly/version.rb
|
121
122
|
- ruby-bitly.gemspec
|
122
123
|
- spec/ruby-bitly_spec.rb
|
123
124
|
- spec/spec_helper.rb
|
124
|
-
homepage: http://github.com/
|
125
|
+
homepage: http://github.com/dx7/ruby-bitly
|
125
126
|
licenses: []
|
126
127
|
metadata: {}
|
127
128
|
post_install_message:
|
@@ -130,17 +131,17 @@ require_paths:
|
|
130
131
|
- lib
|
131
132
|
required_ruby_version: !ruby/object:Gem::Requirement
|
132
133
|
requirements:
|
133
|
-
- -
|
134
|
+
- - ">="
|
134
135
|
- !ruby/object:Gem::Version
|
135
136
|
version: '0'
|
136
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
138
|
requirements:
|
138
|
-
- -
|
139
|
+
- - ">="
|
139
140
|
- !ruby/object:Gem::Version
|
140
141
|
version: '0'
|
141
142
|
requirements: []
|
142
143
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.5.1
|
144
145
|
signing_key:
|
145
146
|
specification_version: 4
|
146
147
|
summary: A simple bit.ly ruby client
|