reward_station 0.0.4 → 0.0.5
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/reward_station/client.rb +26 -6
- data/lib/reward_station/version.rb +1 -1
- metadata +4 -4
@@ -126,12 +126,11 @@ module RewardStation
|
|
126
126
|
|
127
127
|
def request_with_token method_name, params
|
128
128
|
update_token unless @token
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
request method_name, params
|
129
|
+
|
130
|
+
retry_with_token :tries => 2 do
|
131
|
+
inject_token params
|
132
|
+
request method_name, params
|
133
|
+
end
|
135
134
|
end
|
136
135
|
|
137
136
|
def request method_name, params
|
@@ -159,5 +158,26 @@ module RewardStation
|
|
159
158
|
def get_response method_name, params
|
160
159
|
Client.get_client.request(:wsdl, method_name , params).to_hash
|
161
160
|
end
|
161
|
+
|
162
|
+
private
|
163
|
+
|
164
|
+
def retry_with_token( options = {})
|
165
|
+
opts = {:tries => 1}.merge(options)
|
166
|
+
|
167
|
+
if (tries = opts[:tries]) <= 0
|
168
|
+
return
|
169
|
+
end
|
170
|
+
|
171
|
+
begin
|
172
|
+
return yield
|
173
|
+
rescue InvalidToken => ex
|
174
|
+
if (tries -= 1) > 0
|
175
|
+
update_token
|
176
|
+
retry
|
177
|
+
else
|
178
|
+
raise ex
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
162
182
|
end
|
163
183
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reward_station
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Stepan Filatov
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-07-
|
19
|
+
date: 2011-07-21 00:00:00 +04:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|