xero_gateway 2.0.16 → 2.0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/examples/partner_app.rb +2 -2
- data/lib/xero_gateway/oauth.rb +5 -0
- data/xero_gateway.gemspec +1 -1
- metadata +3 -3
data/examples/partner_app.rb
CHANGED
@@ -23,7 +23,7 @@ oauth_verifier = gets.chomp
|
|
23
23
|
|
24
24
|
gateway.authorize_from_request(gateway.request_token.token, gateway.request_token.secret, :oauth_verifier => oauth_verifier)
|
25
25
|
|
26
|
-
puts "Your access token/secret: #{gateway.access_token.token}, #{gateway.access_token.secret}. Expires: #{gateway.
|
26
|
+
puts "Your access token/secret: #{gateway.access_token.token}, #{gateway.access_token.secret}. Expires: #{gateway.expires_at}"
|
27
27
|
puts "(Good for 30 Minutes - but we can renew it!)"
|
28
28
|
|
29
29
|
puts "Session Handle: #{gateway.session_handle}"
|
@@ -33,4 +33,4 @@ pp gateway.get_contacts.contacts.map(&:name)
|
|
33
33
|
|
34
34
|
# Renew!
|
35
35
|
gateway.renew_access_token(gateway.access_token.token, gateway.access_token.secret, gateway.session_handle)
|
36
|
-
puts "Your renewed access token/secret is: #{gateway.access_token.token}, #{gateway.access_token.secret}. Expires: #{gateway.
|
36
|
+
puts "Your renewed access token/secret is: #{gateway.access_token.token}, #{gateway.access_token.secret}. Expires: #{gateway.expires_at}"
|
data/lib/xero_gateway/oauth.rb
CHANGED
@@ -70,6 +70,11 @@ module XeroGateway
|
|
70
70
|
})
|
71
71
|
|
72
72
|
update_attributes_from_token(access_token)
|
73
|
+
rescue OAuth::Unauthorized => e
|
74
|
+
# If the original access token is for some reason invalid an OAuth::Unauthorized could be raised.
|
75
|
+
# In this case raise a XeroGateway::OAuth::TokenInvalid which can be captured by the caller. In this
|
76
|
+
# situation the end user will need to re-authorize the application via the request token authorization URL
|
77
|
+
raise XeroGateway::OAuth::TokenInvalid.new(e.message)
|
73
78
|
end
|
74
79
|
|
75
80
|
private
|
data/xero_gateway.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xero_gateway
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 45
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 17
|
10
|
+
version: 2.0.17
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tim Connor
|