ruby-bitly 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8e00677c2229d902e7a313440f78d6e87a94a60
4
- data.tar.gz: 033846db3c3691ade37782e9f436022f2aa2e090
3
+ metadata.gz: d1771cca1a80ce56b33cfb9578d3bd378f0ce83c
4
+ data.tar.gz: c0fffae72cbab2491b2bb4a5688f192b6d48af00
5
5
  SHA512:
6
- metadata.gz: 7fd6f69ce0a634a1328f0ce699be96b524661cc1f1d6105c15d0c6fdbd36876c41d4a18d8e42607ac499007d60214f41964e7967cec7d81ffc96793b45d5e7bd
7
- data.tar.gz: bf4b2ee95401e3efdf5615c844432a64eae8c5af684321fb20eac07a73d9eee0e5f0584c45aadba4b56e3298151ad7c903576634f57b75212df1d99848bdceb5
6
+ metadata.gz: ed38e9827405f2463b37377ed955801c8f4be6173f418e83b777feacc4f123f150f8cad56f0f0cdbe2f30af80bf7ef33106586bdea31cac9fc8dc49a66f6e616
7
+ data.tar.gz: 9d3ecf027d2a2bf44786337415ce1ae88e565b00507c037d5787a3092d64bb4f81045ecf431446b7b8063ab75f9d8a81ffd0bfe60e44be09918dfb129e467f08
@@ -4,3 +4,4 @@ rvm:
4
4
  - 2.1.10
5
5
  - 2.2.5
6
6
  - 2.3.1
7
+ - 2.4.0
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.2.1
2
+ - Add support for ruby 2.4.0
3
+ - Add support for set domain on command line
4
+ - Remove feature 'copy to clipboard' on command line
5
+
1
6
  # 0.2.0
2
7
 
3
8
  - Add http_proxy support by default
@@ -1,28 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-bitly (0.2.0)
4
+ ruby-bitly (0.2.1)
5
5
  rest-client (~> 2.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- addressable (2.4.0)
10
+ addressable (2.5.0)
11
+ public_suffix (~> 2.0, >= 2.0.2)
11
12
  byebug (9.0.6)
12
13
  crack (0.4.3)
13
14
  safe_yaml (~> 1.0.0)
14
- diff-lcs (1.2.5)
15
- domain_name (0.5.20160826)
15
+ diff-lcs (1.3)
16
+ domain_name (0.5.20170223)
16
17
  unf (>= 0.0.5, < 1.0.0)
17
- hashdiff (0.3.0)
18
+ hashdiff (0.3.2)
18
19
  http-cookie (1.0.3)
19
20
  domain_name (~> 0.5)
20
21
  mime-types (3.1)
21
22
  mime-types-data (~> 3.2015)
22
23
  mime-types-data (3.2016.0521)
23
24
  netrc (0.11.0)
24
- rake (11.3.0)
25
- rest-client (2.0.0)
25
+ public_suffix (2.0.5)
26
+ rake (12.0.0)
27
+ rest-client (2.0.1)
26
28
  http-cookie (>= 1.0.2, < 2.0)
27
29
  mime-types (>= 1.16, < 4.0)
28
30
  netrc (~> 0.8)
@@ -44,7 +46,7 @@ GEM
44
46
  unf_ext
45
47
  unf_ext (0.0.7.2)
46
48
  vcr (3.0.3)
47
- webmock (2.1.0)
49
+ webmock (2.3.2)
48
50
  addressable (>= 2.3.6)
49
51
  crack (>= 0.3.2)
50
52
  hashdiff
@@ -61,4 +63,4 @@ DEPENDENCIES
61
63
  webmock (~> 2.1)
62
64
 
63
65
  BUNDLED WITH
64
- 1.13.2
66
+ 1.14.6
@@ -38,10 +38,10 @@
38
38
  bitly = Bitly.shorten("https://dx7.github.io/", "login-here", "key-here")
39
39
 
40
40
  # new way
41
- bitly = Bitly.shorten(long_url: "https://dx7.github.io/")
41
+ bitly = Bitly.shorten(url: "https://dx7.github.io/")
42
42
 
43
43
  # new way setting local configuration
44
- bitly = Bitly.shorten(long_url: "https://dx7.github.io/", login: "login-here", api_key: "key-here", domain: "my.do")
44
+ bitly = Bitly.shorten(url: "https://dx7.github.io/", login: "login-here", api_key: "key-here", domain: "my.do")
45
45
 
46
46
  # result
47
47
  bitly.url #=> "http://bit.ly/2dAjjfo"
@@ -65,10 +65,10 @@
65
65
  bitly = Bitly.expand("http://bit.ly/2dAjjfo", "login-here", "key-here")
66
66
 
67
67
  # new way
68
- bitly = Bitly.expand(short_url: "http://bit.ly/2dAjjfo")
68
+ bitly = Bitly.expand(url: "http://bit.ly/2dAjjfo")
69
69
 
70
70
  # new way setting local configuration
71
- bitly = Bitly.expand(short_url: "http://bit.ly/2dAjjfo", login: "login-here", api_key: "key-here")
71
+ bitly = Bitly.expand(url: "http://bit.ly/2dAjjfo", login: "login-here", api_key: "key-here")
72
72
 
73
73
  # result
74
74
  y bitly
@@ -88,10 +88,10 @@
88
88
  bitly = Bitly.get_clicks("http://bit.ly/2dAjjfo", "login-here", "key-here")
89
89
 
90
90
  # new way
91
- bitly = Bitly.get_clicks(short_url: "http://bit.ly/2dAjjfo")
91
+ bitly = Bitly.get_clicks(url: "http://bit.ly/2dAjjfo")
92
92
 
93
93
  # new way setting local configuration
94
- bitly = Bitly.get_clicks(short_url: "http://bit.ly/2dAjjfo", login: "login-here", api_key: "key-here")
94
+ bitly = Bitly.get_clicks(url: "http://bit.ly/2dAjjfo", login: "login-here", api_key: "key-here")
95
95
 
96
96
  # result
97
97
  y bitly
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  require 'bundler/gem_tasks'
3
2
  require 'rspec/core/rake_task'
4
3
 
data/bin/bitly CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- # -*- encoding: utf-8 -*-
3
2
 
4
3
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
5
4
 
@@ -31,8 +30,6 @@ class App
31
30
  result = process_command
32
31
 
33
32
  puts "#{options.message} #{result}".strip
34
-
35
- copy_to_clipboard(result)
36
33
  else
37
34
  output_help("ERROR: Invalid options", 'examples')
38
35
  end
@@ -40,12 +37,6 @@ class App
40
37
 
41
38
  protected
42
39
 
43
- def copy_to_clipboard(value)
44
- unless value.nil?
45
- system "printf '#{value.strip}' 2> /dev/null | pbcopy 2> /dev/null" if RUBY_PLATFORM[/darwin/]
46
- end
47
- end
48
-
49
40
  def load_account_data
50
41
  begin
51
42
  account_data = YAML.load(File.read(ACCOUNT_FILE_PATH))
@@ -74,8 +65,9 @@ class App
74
65
  opts.on('-u', '--user-clicks') { options.user_clicks = true; options.message = 'User clicks:' }
75
66
  opts.on('-g', '--global-clicks') { options.global_clicks = true; options.message = 'Global clicks:' }
76
67
 
77
- opts.on('-l', '--login LOGIN') { |login| options.login = login }
78
- opts.on('-k', '--key KEY') { |key| options.key = key }
68
+ opts.on('-l', '--login LOGIN') { |login| options.login = login }
69
+ opts.on('-k', '--key KEY') { |key| options.key = key }
70
+ opts.on('-d', '--domain DOMAIN') { |domain| options.domain = domain }
79
71
 
80
72
  opts.on('-v', '--version') { output_version ; exit 0 }
81
73
  opts.on('-h', '--help') { output_help }
@@ -128,10 +120,11 @@ class App
128
120
  end
129
121
 
130
122
  def process_command
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
123
+ return Bitly.shorten(url: arguments.first, login: options.login, api_key: options.key, domain: options.domain).url if options.shorten && options.domain
124
+ return Bitly.shorten(url: arguments.first, login: options.login, api_key: options.key).url if options.shorten
125
+ return Bitly.expand(url: arguments.first, login: options.login, api_key: options.key).long_url if options.expand
126
+ return Bitly.get_clicks(url: arguments.first, login: options.login, api_key: options.key).user_clicks.to_s if options.user_clicks
127
+ return Bitly.get_clicks(url: arguments.first, login: options.login, api_key: options.key).global_clicks.to_s if options.global_clicks
135
128
  end
136
129
  end
137
130
 
@@ -1,8 +1,8 @@
1
- # -*- encoding: utf-8 -*-
2
1
  require 'yaml'
3
2
  require 'rest-client'
4
3
  require 'json'
5
4
  require 'ostruct'
5
+ require 'ruby-bitly/version'
6
6
 
7
7
  class Bitly < OpenStruct
8
8
 
@@ -35,7 +35,7 @@ class Bitly < OpenStruct
35
35
 
36
36
  # Old API:
37
37
  #
38
- # shorten(long_url, login = self.login, key = self.key)
38
+ # shorten(long_url, login = self.login, api_key = self.api_key)
39
39
  #
40
40
  # New API:
41
41
  #
@@ -47,23 +47,11 @@ class Bitly < OpenStruct
47
47
  # :login
48
48
  # :api_key
49
49
  # :domain
50
- def shorten(long_url, login = self.login, key = self.key)
51
- if long_url.is_a?(Hash)
52
- options = long_url
53
- long_url = options[:long_url]
54
- login = options[:login] || self.login
55
- key = options[:api_key] || self.key
56
- else
57
- options = {}
58
- end
59
-
60
- params = { :longURL => long_url, :login => login, :apiKey => key }
50
+ def shorten(long_url, login = self.login, api_key = self.api_key)
51
+ options = ensure_options(url: long_url, login: login, api_key: api_key)
52
+ options.select! { |k,_v| [:longURL, :domain, :login, :apiKey].include?(k) }
61
53
 
62
- if options[:domain]
63
- params[:domain] = options[:domain]
64
- end
65
-
66
- response = JSON.parse RestClient.post(rest_api_url + ACTION_PATH[:shorten], params)
54
+ response = JSON.parse RestClient.post(rest_api_url + ACTION_PATH[:shorten], options)
67
55
  response.delete("data") if response["data"].empty?
68
56
 
69
57
  bitly = new response["data"]
@@ -77,7 +65,7 @@ class Bitly < OpenStruct
77
65
 
78
66
  # Old API:
79
67
  #
80
- # expand(short_url, login = self.login, key = self.key)
68
+ # expand(short_url, login = self.login, api_key = self.api_key)
81
69
  #
82
70
  # New API:
83
71
  #
@@ -88,17 +76,11 @@ class Bitly < OpenStruct
88
76
  # :long_url
89
77
  # :login
90
78
  # :api_key
91
- def expand(short_url, login = self.login, key = self.key)
92
- if short_url.is_a?(Hash)
93
- options = short_url
94
- short_url = options[:short_url]
95
- login = options[:login] || self.login
96
- key = options[:api_key] || self.key
97
- else
98
- options = {}
99
- end
79
+ def expand(short_url, login = self.login, api_key = self.api_key)
80
+ options = ensure_options(url: short_url, login: login, api_key: api_key)
81
+ options.select! { |k,_v| [:shortURL, :login, :apiKey].include?(k) }
100
82
 
101
- response = JSON.parse RestClient.post(rest_api_url + ACTION_PATH[:expand], { :shortURL => short_url, :login => login, :apiKey => key })
83
+ response = JSON.parse RestClient.post(rest_api_url + ACTION_PATH[:expand], options)
102
84
 
103
85
  bitly = new(response["data"]["expand"].first)
104
86
  bitly.status_code = response["status_code"]
@@ -110,7 +92,7 @@ class Bitly < OpenStruct
110
92
 
111
93
  # Old API:
112
94
  #
113
- # get_clicks(short_url, login = self.login, key = self.key)
95
+ # get_clicks(short_url, login = self.login, api_key = self.api_key)
114
96
  #
115
97
  # New API:
116
98
  #
@@ -121,17 +103,12 @@ class Bitly < OpenStruct
121
103
  # :long_url
122
104
  # :login
123
105
  # :api_key
124
- def get_clicks(short_url, login = self.login, key = self.key)
125
- if short_url.is_a?(Hash)
126
- options = short_url
127
- short_url = options[:short_url]
128
- login = options[:login] || self.login
129
- key = options[:api_key] || self.key
130
- else
131
- options = {}
132
- end
106
+ def get_clicks(short_url, login = self.login, api_key = self.api_key)
107
+ options = ensure_options(url: short_url, login: login, api_key: api_key)
108
+ options.select! { |k,_v| [:shortURL, :login, :apiKey].include?(k) }
109
+ options[:shortUrl] = options.delete(:shortURL)
133
110
 
134
- response = JSON.parse RestClient.get("#{rest_api_url}#{ACTION_PATH[:clicks]}?login=#{login}&apiKey=#{key}&shortUrl=#{short_url}")
111
+ response = JSON.parse RestClient.get("#{rest_api_url}#{ACTION_PATH[:clicks]}", params: options)
135
112
 
136
113
  bitly = new(response["data"]["clicks"].first)
137
114
  bitly.status_code = response["status_code"]
@@ -142,6 +119,18 @@ class Bitly < OpenStruct
142
119
 
143
120
  private
144
121
 
122
+ def ensure_options(options)
123
+ options = options[:url] if options[:url].is_a?(Hash)
124
+
125
+ response = {}
126
+ response[:shortURL] = options[:short_url] || options[:url]
127
+ response[:longURL] = options[:long_url] || options[:url]
128
+ response[:login] = options[:login] || self.login
129
+ response[:apiKey] = options[:api_key] || self.api_key
130
+ response[:domain] = options[:domain]
131
+ response.reject { |_k,v| v.nil? }
132
+ end
133
+
145
134
  def rest_api_url
146
135
  use_ssl ? REST_API_URL_SSL : REST_API_URL
147
136
  end
@@ -1,3 +1,3 @@
1
1
  module BitlyGem
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  $:.push File.expand_path("../lib", __FILE__)
3
2
  require "ruby-bitly/version"
4
3
 
@@ -1,10 +1,9 @@
1
- # -*- encoding: utf-8 -*-
2
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
2
 
4
3
  describe 'RubyBitly' do
5
4
 
6
5
  let(:login) { RSpec::RUBY_BITLY_LOGIN }
7
- let(:key) { RSpec::RUBY_BITLY_APIKEY }
6
+ let(:api_key) { RSpec::RUBY_BITLY_APIKEY }
8
7
 
9
8
  describe 'config' do
10
9
  it 'set variable login' do
@@ -12,7 +11,7 @@ describe 'RubyBitly' do
12
11
  expect(Bitly.login).to eq('login-custom')
13
12
  end
14
13
 
15
- it 'set variables key' do
14
+ it 'set variables api_key' do
16
15
  Bitly.config { |c| c.api_key = 'key-custom' }
17
16
  expect(Bitly.api_key).to eq('key-custom')
18
17
  end
@@ -27,12 +26,12 @@ describe 'RubyBitly' do
27
26
  describe 'shorten' do
28
27
  context 'using local config' do
29
28
  before do
30
- Bitly.config { |c| c.login = 'invalid login'; c.api_key = 'invalid key' }
29
+ Bitly.config { |c| c.login = 'invalid login'; c.api_key = 'invalid api_key' }
31
30
  end
32
31
 
33
32
  it 'shorten long url using old API' do
34
33
  response = VCR.use_cassette('shorten_long_url') do
35
- Bitly.shorten('http://google.com', login, key)
34
+ Bitly.shorten('http://google.com', login, api_key)
36
35
  end
37
36
 
38
37
  expect(response.status_txt).to eq('OK')
@@ -45,7 +44,7 @@ describe 'RubyBitly' do
45
44
 
46
45
  it 'shorten long url using new API' do
47
46
  response = VCR.use_cassette('shorten_long_url') do
48
- Bitly.shorten(:long_url => 'http://google.com', :login => login, :api_key => key)
47
+ Bitly.shorten(:long_url => 'http://google.com', :login => login, :api_key => api_key)
49
48
  end
50
49
 
51
50
  expect(response.status_txt).to eq('OK')
@@ -58,7 +57,7 @@ describe 'RubyBitly' do
58
57
 
59
58
  it 'shorten long url with a preferred domain' do
60
59
  response = VCR.use_cassette('shorten_long_url_with_preferred_domain') do
61
- Bitly.shorten(:long_url => 'http://google.com', :domain => 'j.mp', :login => login, :api_key => key)
60
+ Bitly.shorten(:long_url => 'http://google.com', :domain => 'j.mp', :login => login, :api_key => api_key)
62
61
  end
63
62
 
64
63
  expect(response.status_txt).to eq('OK')
@@ -71,7 +70,7 @@ describe 'RubyBitly' do
71
70
 
72
71
  it 'shorten bitly url' do
73
72
  response = VCR.use_cassette('shorten_bitly_url') do
74
- Bitly.shorten('http://bit.ly/bcvNe5', login, key)
73
+ Bitly.shorten('http://bit.ly/bcvNe5', login, api_key)
75
74
  end
76
75
 
77
76
  expect(response.status_txt).to eq('ALREADY_A_BITLY_LINK')
@@ -81,7 +80,7 @@ describe 'RubyBitly' do
81
80
 
82
81
  context 'using global config' do
83
82
  before do
84
- Bitly.config { |c| c.login = login; c.api_key = key }
83
+ Bitly.config { |c| c.login = login; c.api_key = api_key }
85
84
  end
86
85
 
87
86
  it 'shorten long url using old API' do
@@ -115,12 +114,12 @@ describe 'RubyBitly' do
115
114
  describe 'expand' do
116
115
  context 'using local config' do
117
116
  before do
118
- Bitly.config { |c| c.login = 'invalid login'; c.api_key = 'invalid key' }
117
+ Bitly.config { |c| c.login = 'invalid login'; c.api_key = 'invalid api_key' }
119
118
  end
120
119
 
121
120
  it 'expand a short url to its long url old API' do
122
121
  response = VCR.use_cassette('expand_a_short_url_to_it_long_url') do
123
- Bitly.expand('http://bit.ly/bcvNe5', login, key)
122
+ Bitly.expand('http://bit.ly/bcvNe5', login, api_key)
124
123
  end
125
124
 
126
125
  expect(response.status_txt).to eq('OK')
@@ -132,7 +131,7 @@ describe 'RubyBitly' do
132
131
 
133
132
  it 'expand a short url to its long url' do
134
133
  response = VCR.use_cassette('expand_a_short_url_to_it_long_url') do
135
- Bitly.expand({ :short_url => 'http://bit.ly/bcvNe5', :login => login, :api_key => key })
134
+ Bitly.expand({ :short_url => 'http://bit.ly/bcvNe5', :login => login, :api_key => api_key })
136
135
  end
137
136
 
138
137
  expect(response.status_txt).to eq('OK')
@@ -144,7 +143,7 @@ describe 'RubyBitly' do
144
143
 
145
144
  it 'expand a long url should result an error' do
146
145
  response = VCR.use_cassette('expand_a_long_url_should_result_an_error') do
147
- Bitly.expand('http://google.com', login, key)
146
+ Bitly.expand('http://google.com', login, api_key)
148
147
  end
149
148
 
150
149
  expect(response.status_txt).to eq('OK')
@@ -156,7 +155,7 @@ describe 'RubyBitly' do
156
155
 
157
156
  context 'using global config' do
158
157
  before do
159
- Bitly.config { |c| c.login = login; c.api_key = key }
158
+ Bitly.config { |c| c.login = login; c.api_key = api_key }
160
159
  end
161
160
 
162
161
  it 'expand a short url to its long url old API' do
@@ -189,18 +188,18 @@ describe 'RubyBitly' do
189
188
  describe 'get clicks' do
190
189
  context 'using local config' do
191
190
  before do
192
- Bitly.config { |c| c.login = 'invalid login'; c.api_key = 'invalid key' }
191
+ Bitly.config { |c| c.login = 'invalid login'; c.api_key = 'invalid api_key' }
193
192
  end
194
193
 
195
194
  it 'get clicks by short_url using old API' do
196
195
  bitly = VCR.use_cassette('get_clicks_by_short_url') do
197
- Bitly.get_clicks('http://bit.ly/xlii42', login, key)
196
+ Bitly.get_clicks('http://bit.ly/xlii42', login, api_key)
198
197
  end
199
198
 
200
199
  expect(bitly.status_txt).to eq('OK')
201
200
  expect(bitly.status_code).to eq(200)
202
- expect(bitly.global_clicks).to be_an_instance_of Fixnum
203
- expect(bitly.user_clicks).to be_an_instance_of Fixnum
201
+ expect(bitly.global_clicks).to be_an Integer
202
+ expect(bitly.user_clicks).to be_an Integer
204
203
  expect(bitly.short_url).to eq('http://bit.ly/xlii42')
205
204
  expect(bitly.global_hash).to eq('cunZEP')
206
205
  expect(bitly.user_hash).to eq('cT1Izu')
@@ -208,13 +207,13 @@ describe 'RubyBitly' do
208
207
 
209
208
  it 'get clicks by short_url using options API' do
210
209
  bitly = VCR.use_cassette('get_clicks_by_short_url') do
211
- Bitly.get_clicks(:short_url => 'http://bit.ly/xlii42', :login => login, :api_key => key)
210
+ Bitly.get_clicks(:short_url => 'http://bit.ly/xlii42', :login => login, :api_key => api_key)
212
211
  end
213
212
 
214
213
  expect(bitly.status_txt).to eq('OK')
215
214
  expect(bitly.status_code).to eq(200)
216
- expect(bitly.global_clicks).to be_an_instance_of Fixnum
217
- expect(bitly.user_clicks).to be_an_instance_of Fixnum
215
+ expect(bitly.global_clicks).to be_an Integer
216
+ expect(bitly.user_clicks).to be_an Integer
218
217
  expect(bitly.short_url).to eq('http://bit.ly/xlii42')
219
218
  expect(bitly.global_hash).to eq('cunZEP')
220
219
  expect(bitly.user_hash).to eq('cT1Izu')
@@ -223,7 +222,7 @@ describe 'RubyBitly' do
223
222
 
224
223
  context 'using global config' do
225
224
  before do
226
- Bitly.config { |c| c.login = login; c.api_key = key }
225
+ Bitly.config { |c| c.login = login; c.api_key = api_key }
227
226
  end
228
227
 
229
228
  it 'get clicks by short_url using old API' do
@@ -233,8 +232,8 @@ describe 'RubyBitly' do
233
232
 
234
233
  expect(bitly.status_txt).to eq('OK')
235
234
  expect(bitly.status_code).to eq(200)
236
- expect(bitly.global_clicks).to be_an_instance_of Fixnum
237
- expect(bitly.user_clicks).to be_an_instance_of Fixnum
235
+ expect(bitly.global_clicks).to be_an Integer
236
+ expect(bitly.user_clicks).to be_an Integer
238
237
  expect(bitly.short_url).to eq('http://bit.ly/xlii42')
239
238
  expect(bitly.global_hash).to eq('cunZEP')
240
239
  expect(bitly.user_hash).to eq('cT1Izu')
@@ -247,8 +246,8 @@ describe 'RubyBitly' do
247
246
 
248
247
  expect(bitly.status_txt).to eq('OK')
249
248
  expect(bitly.status_code).to eq(200)
250
- expect(bitly.global_clicks).to be_an_instance_of Fixnum
251
- expect(bitly.user_clicks).to be_an_instance_of Fixnum
249
+ expect(bitly.global_clicks).to be_an Integer
250
+ expect(bitly.user_clicks).to be_an Integer
252
251
  expect(bitly.short_url).to eq('http://bit.ly/xlii42')
253
252
  expect(bitly.global_hash).to eq('cunZEP')
254
253
  expect(bitly.user_hash).to eq('cT1Izu')
@@ -284,7 +283,7 @@ describe 'RubyBitly' do
284
283
  Bitly.use_ssl = false
285
284
 
286
285
  bitly = VCR.use_cassette('get_clicks_by_short_url_without_ssl') do
287
- Bitly.get_clicks(:short_url => 'http://bit.ly/xlii42', :login => login, :api_key => key)
286
+ Bitly.get_clicks(:short_url => 'http://bit.ly/xlii42', :login => login, :api_key => api_key)
288
287
  end
289
288
 
290
289
  expect(bitly.status_txt).to eq('OK')
@@ -1,4 +1,3 @@
1
- # -*- encoding: utf-8 -*-
2
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
3
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
3
  require 'byebug'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-bitly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dx7
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-03 00:00:00.000000000 Z
11
+ date: 2017-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  version: '0'
146
146
  requirements: []
147
147
  rubyforge_project:
148
- rubygems_version: 2.5.1
148
+ rubygems_version: 2.6.10
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: A simple bit.ly ruby client to shorten URLs, expand or get number of clicks