ocean-rails 5.0.7 → 5.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ocean/api.rb +11 -8
  3. data/lib/ocean/version.rb +1 -1
  4. metadata +16 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7d79bfcbbf4be753bd5372de2d2c51bbf738a054
4
- data.tar.gz: b8daf05f832308be324854b51effb6a2a91de038
3
+ metadata.gz: 40050eb257fba2f83fd89c819244b4cad0d8c5e8
4
+ data.tar.gz: bbf7ecc4d993e7b9c5fa97da6d22b60a33c5e784
5
5
  SHA512:
6
- metadata.gz: c34686625ae8e086b87f9e1773287ae25504dd97947cd386cd9e0cedbafb01ae27f9171b526d6b93e8a1a35aa711a1d904fd56904d35611e411ffed98f310957
7
- data.tar.gz: ae82f068ff7652a216fb8323707ab9d0169bd432f1a3ef7ab3e3f3ec478a353043567c54ec476f2cebd1c038d5299cf422c8f1aadc8156821f7792e0bc05cc1d
6
+ metadata.gz: 25daad9c964b1e92cf7eb9504b46db6f3de4dd387617666f6dc5f5d27ff8582429d5d1626c32b5c69687db9e4422027f675550a406bce92bc961e3b776e6246f
7
+ data.tar.gz: 4b5097c0314c9daf4f3651a019529d6a0960d6c30c62ca278a8e6fca8d4ca15d474f141a007468c2c4467ec083fe7f1d496452d5714ded3725968b5d668545b9
data/lib/ocean/api.rb CHANGED
@@ -161,8 +161,7 @@ class Api
161
161
  #
162
162
  # Automatic retries for GET requests are available:
163
163
  #
164
- # +retries+, if given and > 0, specifies the number of retries to perform for GET requests.
165
- # Defaults to 0, meaning no retries.
164
+ # +retries+, if given and > 0, specifies the number of retries to perform for GET requests. Defaults to 0, meaning no retries.
166
165
  # +backoff_time+ (default 1) the initial time to wait between retries.
167
166
  # +backoff_rate+ (default 0.9) the rate at which the time is increased.
168
167
  # +backoff_max+ (default 30) the maximum time to wait between retries.
@@ -172,6 +171,11 @@ class Api
172
171
  # settings will generate the progression 1, 1.9, 3.61, 6.859, 13.0321, 24.76099, 30, 30,
173
172
  # 30, etc. To disable waiting between retries entirely, set +backoff_time+ to zero.
174
173
  #
174
+ # If a +postprocessor+ block is given, it will be called with the result of the response;
175
+ # whatever it returns will be returned as the result of the Api request.
176
+ #
177
+ # +Api.request+ can be called inside a +simultaneously+ block.
178
+ #
175
179
  def self.request(url, http_method, args: nil, headers: {}, body: nil,
176
180
  credentials: nil,
177
181
  x_api_token: headers['X-API-Token'],
@@ -179,7 +183,7 @@ class Api
179
183
  ssl_verifypeer: true, ssl_verifyhost: 2,
180
184
  retries: 0, backoff_time: 1, backoff_rate: 0.9, backoff_max: 30,
181
185
  x_metadata: Thread.current[:metadata],
182
- &block)
186
+ &postprocessor)
183
187
  # Set up the request
184
188
  headers['Accept'] = "application/json"
185
189
  headers['Content-Type'] = "application/json" if [:post, :put].include?(http_method)
@@ -219,7 +223,7 @@ class Api
219
223
  # calls done by the post-processor will use the same response
220
224
  # accessors, which means the final result will be what the last
221
225
  # post-processor to finish returns.
222
- response = block.call(response) if block
226
+ response = postprocessor.call(response) if postprocessor
223
227
  when 300..399
224
228
  nil # Done, redirect
225
229
  when 400, 419
@@ -282,13 +286,12 @@ class Api
282
286
  # r << Api.request("http://foo.quux", :get, retries: 3)
283
287
  # end
284
288
  #
285
- # The value returned is an array of responses from the Api.request calls. If a request
286
- # has a post-processor block, the result will not be the response but what the block
287
- # returns.
289
+ # The value returned is an array of responses from the Api.request calls.
288
290
  #
289
291
  # TimeoutErrors and NoResponseError will not be raised in parallel mode.
290
292
  #
291
- # Only Api.request is supported at the present time. Api::RemoteResource will follow.
293
+ # Only +Api.request+ is supported at the present time. Api::RemoteResource will follow,
294
+ # but requires a major internal reorganisation of Api::RemoteResource. It's underway.
292
295
  #
293
296
  def self.simultaneously (&block)
294
297
  raise "block required" unless block
data/lib/ocean/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "5.0.7"
2
+ VERSION = "5.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.7
4
+ version: 5.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson
@@ -16,84 +16,84 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.7.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.7.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ffi
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 1.9.10
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 1.9.10
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ffi-rzmq
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '2.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rack-attack
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 4.3.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 4.3.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jbuilder
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 2.3.1
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 2.3.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: ocean-dynamo
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 0.7.4
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 0.7.4
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rails
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -267,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
267
  version: '0'
268
268
  requirements: []
269
269
  rubyforge_project:
270
- rubygems_version: 2.4.8
270
+ rubygems_version: 2.4.6
271
271
  signing_key:
272
272
  specification_version: 4
273
273
  summary: This gem implements common Ocean behaviour for Ruby and Ruby on Rails.