geoloqi 0.9.14 → 0.9.15
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.
- data/lib/geoloqi/config.rb +1 -1
- data/lib/geoloqi/session.rb +1 -1
- data/lib/geoloqi/version.rb +2 -2
- data/spec/geoloqi_spec.rb +6 -0
- metadata +2 -2
data/lib/geoloqi/config.rb
CHANGED
@@ -2,10 +2,10 @@ module Geoloqi
|
|
2
2
|
class Config
|
3
3
|
attr_accessor :client_id, :client_secret, :redirect_uri, :adapter, :enable_logging, :use_hashie_mash, :throw_exceptions
|
4
4
|
def initialize(opts={})
|
5
|
-
opts.each {|k,v| send("#{k}=", v)}
|
6
5
|
self.enable_logging ||= false
|
7
6
|
self.use_hashie_mash ||= false
|
8
7
|
self.throw_exceptions ||= true
|
8
|
+
opts.each {|k,v| send("#{k}=", v)}
|
9
9
|
begin
|
10
10
|
require 'hashie' if self.use_hashie_mash && !defined?(Hashie::Mash)
|
11
11
|
rescue LoadError
|
data/lib/geoloqi/session.rb
CHANGED
@@ -46,7 +46,7 @@ module Geoloqi
|
|
46
46
|
begin
|
47
47
|
response = execute meth, path, query
|
48
48
|
hash = JSON.parse response.body
|
49
|
-
raise ApiError.new(response.status, hash['error'], hash['error_description']) if hash.is_a?(Hash) && hash['error'] &&
|
49
|
+
raise ApiError.new(response.status, hash['error'], hash['error_description']) if hash.is_a?(Hash) && hash['error'] && @config.throw_exceptions
|
50
50
|
rescue Geoloqi::ApiError
|
51
51
|
raise Error.new('Unable to procure fresh access token from API on second attempt') if retry_attempt > 0
|
52
52
|
if hash['error'] == 'expired_token'
|
data/lib/geoloqi/version.rb
CHANGED
data/spec/geoloqi_spec.rb
CHANGED
@@ -76,6 +76,12 @@ describe Geoloqi::Session do
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
+
describe 'with access token and throw exceptions not set' do
|
80
|
+
it 'should throw api error exception' do
|
81
|
+
expect { rescuing {Geoloqi::Session.new(:access_token => 'access_token1234').get('badmethodcall')}.class == Geoloqi::ApiError }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
79
85
|
describe 'with access token and throw exceptions false' do
|
80
86
|
before do
|
81
87
|
@session = Geoloqi::Session.new :access_token => 'access_token1234', :config => {:throw_exceptions => false}
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: geoloqi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.15
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Kyle Drake
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-07-
|
14
|
+
date: 2011-07-17 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|