Skip to content

Commit 193915a

Browse files
author
Adam Boudreau
committed
Force refreshing auth token when determine soap stack fails and retry getting url before raising exception.
1 parent a663ef7 commit 193915a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/fuelsdk/targeting.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@ def determine_stack(endpoint_service_url=nil)
1919
refresh unless self.auth_token
2020
options = {'params' => {'access_token' => self.auth_token}}
2121
response = get(endpoint_service_url || "https://www.exacttargetapis.com/platform/v1/endpoints/soap", options)
22-
raise 'Unable to determine stack' unless response.success?
22+
23+
unless response.success?
24+
# if unsuccessful, force refresh token and try with new token before raising exception
25+
refresh!
26+
options = {'params' => {'access_token' => self.auth_token}}
27+
response = get(endpoint_service_url || "https://www.exacttargetapis.com/platform/v1/endpoints/soap", options)
28+
29+
raise "Unable to determine stack #{response.code}, #{response.body.inspect}" unless response.success?
30+
end
2331
response['url']
2432
end
2533
end

lib/fuelsdk/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module FuelSDK
2-
VERSION = "0.1.11"
2+
VERSION = "0.1.12"
33
end

0 commit comments

Comments
 (0)