bitly 1.1.1 → 1.1.2

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: '087fb2a63ecc1d2528e91cc06d415921f30d5358'
4
- data.tar.gz: 2b1d6c00ebc719756e84574bf054bd390027c4b5
3
+ metadata.gz: 6a8801e0af73bf65ac762477c11eab29bf2fb3fe
4
+ data.tar.gz: 654ce50db6081aa03e871ebfc3cfb7db1c529d2a
5
5
  SHA512:
6
- metadata.gz: 2c0c174a4c3e6249f35d1b5204639d4e0747a76702b01f0e8cda9c6d27f4e63abf533bfb5bf0afea80ac596455a4f890fe24c23d3d42dcf63dd1837ca4b2f960
7
- data.tar.gz: 330100602a53d6b381c3383814450ccb1edc84d7006fa7520ade4a0bf55b8404da0d1ea2bf925e63bcbdd4ad7bb6ab0a94fdd29e721201cadaceda095570744b
6
+ metadata.gz: eeba81429fdfc4d65107890ae8bb0f6c5c17b924256bfb19d9640ed08aa38fd06ad1d9e4ea42a0a9e29c51b10a2c8b166232fe375767168a974ecbc29b1d2176
7
+ data.tar.gz: d3b5f93048e1d511a7449a7c647c9d1ed44d9e14e54cd62fcd36f6b7cd739c66414a0ff61b5a42a1602981cbeeb1d6ce6d1e2be82296a2e6e05ba61307455ef4
@@ -2,10 +2,10 @@ language: ruby
2
2
  sudo: required
3
3
  dist: trusty
4
4
  rvm:
5
+ - 2.5
5
6
  - 2.4
6
7
  - 2.3
7
8
  - 2.2
8
- - 2.1
9
9
  - ruby-head
10
10
  - jruby-19mode
11
11
  - jruby-head
data/Rakefile CHANGED
@@ -7,5 +7,5 @@ desc 'Run tests (default)'
7
7
  Rake::TestTask.new(:test) do |t|
8
8
  t.test_files = FileList['test/**/test_*.rb']
9
9
  t.ruby_opts = ['-Itest']
10
- t.ruby_opts << '-rubygems' if defined? Gem
10
+ t.ruby_opts << '-r rubygems' if defined? Gem
11
11
  end
@@ -36,7 +36,7 @@ module Bitly
36
36
  class Client
37
37
 
38
38
  include Bitly::Utils
39
- attr_accessor *Config::OPTION_KEYS
39
+ attr_accessor(*Config::OPTION_KEYS)
40
40
 
41
41
  def initialize(login,api_key)
42
42
  warn "[DEPRECATION] The bit.ly version 2 API has been superseded by version 3 and will be removed. See the README for details"
@@ -9,7 +9,7 @@ module Bitly
9
9
  :timeout
10
10
  ]
11
11
 
12
- attr_accessor *OPTION_KEYS
12
+ attr_accessor(*OPTION_KEYS)
13
13
 
14
14
  alias_method :access_token, :login
15
15
  alias_method :access_token=, :login=
@@ -79,22 +79,22 @@ module Bitly
79
79
  # Returns the results in the order they were entered
80
80
  def lookup(input)
81
81
  input = arrayize(input)
82
- query = input.inject([]) { |query, i| query << "url=#{CGI.escape(i)}" }
82
+ query = input.inject([]) { |q, i| q << "url=#{CGI.escape(i)}" }
83
83
  query = "/lookup?" + query.join('&')
84
84
  response = get(query)
85
- results = response['data']['lookup'].inject([]) do |results, url|
85
+ results = response['data']['lookup'].inject([]) do |rs, url|
86
86
  url['long_url'] = url['url']
87
87
  url['url'] = nil
88
88
  if url['error'].nil?
89
89
  # builds the results array in the same order as the input
90
- results[input.index(url['long_url'])] = Bitly::V3::Url.new(self, url)
90
+ rs[input.index(url['long_url'])] = Bitly::V3::Url.new(self, url)
91
91
  # remove the key from the original array, in case the same hash/url was entered twice
92
92
  input[input.index(url['long_url'])] = nil
93
93
  else
94
- results[input.index(url['long_url'])] = Bitly::V3::MissingUrl.new(url)
94
+ rs[input.index(url['long_url'])] = Bitly::V3::MissingUrl.new(url)
95
95
  input[input.index(url['long_url'])] = nil
96
96
  end
97
- results
97
+ rs
98
98
  end
99
99
  return results.length > 1 ? results : results[0]
100
100
  end
@@ -156,7 +156,7 @@ module Bitly
156
156
  end
157
157
 
158
158
  def is_a_short_url?(input)
159
- input.match(/^http:\/\//)
159
+ input.match(/^https?:\/\//)
160
160
  end
161
161
 
162
162
  def get_single_method(method, input)
@@ -173,30 +173,30 @@ module Bitly
173
173
 
174
174
  def get_method(method, input, opts={})
175
175
  input = arrayize(input)
176
- query = input.inject([]) do |query,i|
176
+ query = input.inject([]) do |q, i|
177
177
  if is_a_short_url?(i)
178
- query << "shortUrl=#{CGI.escape(i)}"
178
+ q << "shortUrl=#{CGI.escape(i)}"
179
179
  else
180
- query << "hash=#{CGI.escape(i)}"
180
+ q << "hash=#{CGI.escape(i)}"
181
181
  end
182
182
  end
183
- query = opts.inject(query) do |query, (k,v)|
184
- query << "#{k}=#{v}"
183
+ query = opts.inject(query) do |q, (k,v)|
184
+ q<< "#{k}=#{v}"
185
185
  end
186
186
  query = "/#{method}?" + query.join('&')
187
187
  response = get(query)
188
- results = response['data'][method.to_s].inject([]) do |results, url|
188
+ results = response['data'][method.to_s].inject([]) do |rs, url|
189
189
  result_index = input.index(url['short_url'] || url['hash']) || input.index(url['global_hash'])
190
190
  if url['error'].nil?
191
191
  # builds the results array in the same order as the input
192
- results[result_index] = Bitly::V3::Url.new(self, url)
192
+ rs[result_index] = Bitly::V3::Url.new(self, url)
193
193
  # remove the key from the original array, in case the same hash/url was entered twice
194
194
  input[result_index] = nil
195
195
  else
196
- results[result_index] = Bitly::V3::MissingUrl.new(url)
196
+ rs[result_index] = Bitly::V3::MissingUrl.new(url)
197
197
  input[result_index] = nil
198
198
  end
199
- results
199
+ rs
200
200
  end
201
201
  return results.length > 1 ? results : results[0]
202
202
  end
@@ -107,12 +107,11 @@ module Bitly
107
107
  opts.merge!(:access_token => @access_token.token)
108
108
  result = self.class.get("/user/#{method.to_s}", :query => opts)
109
109
  if result['status_code'] == 200
110
- results = result['data'][method.to_s].map do |rs|
110
+ result['data'][method.to_s].map do |rs|
111
111
  rs.inject([]) do |results, obj|
112
112
  results << klass.new(obj)
113
113
  end
114
114
  end
115
- return results
116
115
  else
117
116
  raise BitlyError.new(result['status_txt'], result['status_code'])
118
117
  end
@@ -1,3 +1,3 @@
1
1
  module Bitly
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitly
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Nash
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-23 00:00:00.000000000 Z
11
+ date: 2018-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json