hoodoo 2.6.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/hoodoo/client/endpoint/endpoint.rb +3 -4
- data/lib/hoodoo/version.rb +2 -2
- data/spec/client/paginated_enumeration_spec.rb +41 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0e686c8d61af9db25a3c714c91d857513677995476a615d524fa330876d3ecfe
|
4
|
+
data.tar.gz: 873e6143a9c010fb0647d03cb88c7d2de94cafffa705c91cdae47a0f801c49ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cb8d790977ac5d24743f527c6446873e032c4186628ae70aca8c84fd1f51189ddce09bfb8d191367918c917b0bb5b714293a9f55f27e0eefabac8563b5829d0
|
7
|
+
data.tar.gz: 069fe304a7adf0e3bace5c28871d7f568962d139b94b83f85cb41480287230ff63151dcfdb3196a0972610ce042c12f79a8ce94d01b1349a340aff3ea825444d
|
@@ -329,17 +329,16 @@ module Hoodoo
|
|
329
329
|
# value set.
|
330
330
|
#
|
331
331
|
def inject_enumeration_state( augmented_array, query_hash )
|
332
|
+
endpoint = self
|
333
|
+
query_hash = Hoodoo::Utilities.stringify( query_hash || {} )
|
334
|
+
batch_size = [ 1, augmented_array.size ].max
|
332
335
|
|
333
|
-
endpoint = self
|
334
|
-
query_hash = query_hash.nil? ? {} : query_hash.dup
|
335
|
-
batch_size = [ 1, augmented_array.size ].max
|
336
336
|
augmented_array.next_page_proc = Proc.new do
|
337
337
|
query_hash[ 'offset' ] = ( query_hash[ 'offset' ] || 0 ) + batch_size
|
338
338
|
endpoint.list( query_hash )
|
339
339
|
end
|
340
340
|
|
341
341
|
return augmented_array
|
342
|
-
|
343
342
|
end
|
344
343
|
|
345
344
|
public
|
data/lib/hoodoo/version.rb
CHANGED
@@ -12,11 +12,11 @@ module Hoodoo
|
|
12
12
|
# The Hoodoo gem version. If this changes, be sure to re-run
|
13
13
|
# <tt>bundle install</tt> or <tt>bundle update</tt>.
|
14
14
|
#
|
15
|
-
VERSION = '2.6.
|
15
|
+
VERSION = '2.6.1'
|
16
16
|
|
17
17
|
# The Hoodoo gem date. If this changes, be sure to re-run
|
18
18
|
# <tt>bundle install</tt> or <tt>bundle update</tt>.
|
19
19
|
#
|
20
|
-
DATE = '2018-
|
20
|
+
DATE = '2018-06-01'
|
21
21
|
|
22
22
|
end
|
@@ -272,7 +272,7 @@ describe Hoodoo::Client do
|
|
272
272
|
}.to raise_error( RuntimeError, 'Hoodoo::Client::PaginatedEnumeration#enumerate_all: Unexpected internal state combination of results set and results error indication' )
|
273
273
|
end
|
274
274
|
|
275
|
-
context 'different "limit" sizes' do
|
275
|
+
context 'with different "limit" sizes' do
|
276
276
|
|
277
277
|
let(:limits) {
|
278
278
|
# Note: Smaller limits will make the tests very slow
|
@@ -299,6 +299,46 @@ describe Hoodoo::Client do
|
|
299
299
|
|
300
300
|
end
|
301
301
|
|
302
|
+
context 'with different "offset" values' do
|
303
|
+
|
304
|
+
let(:offsets) {
|
305
|
+
[ 0, 1, 2, 3, 250, 500, 998, 999, 1000, 1001 ]
|
306
|
+
}
|
307
|
+
|
308
|
+
shared_examples 'enumerator which' do | key |
|
309
|
+
it "obeys offsets via #{ key.inspect }" do
|
310
|
+
|
311
|
+
resources.each do | resource |
|
312
|
+
offsets.each do | offset |
|
313
|
+
numbers = []
|
314
|
+
|
315
|
+
resource[ :endpoint ].list( { key => offset } ).enumerate_all do | result |
|
316
|
+
expect( result.platform_errors.errors ).to eq( [] )
|
317
|
+
break if result.platform_errors.has_errors?
|
318
|
+
numbers << result[ 'number' ]
|
319
|
+
end
|
320
|
+
|
321
|
+
expected_data = resource[ :data ][ offset .. -1 ]
|
322
|
+
|
323
|
+
# If nil, the requested offset is beyond any actual data;
|
324
|
+
# expect empty result set.
|
325
|
+
|
326
|
+
if expected_data.nil?
|
327
|
+
expect( numbers ).to be_empty
|
328
|
+
else
|
329
|
+
expect( numbers ).to eq( expected_data )
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
it_behaves_like 'enumerator which', 'offset'
|
338
|
+
it_behaves_like 'enumerator which', :offset
|
339
|
+
|
340
|
+
end
|
341
|
+
|
302
342
|
end
|
303
343
|
|
304
344
|
context 'error handling behaviour' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoodoo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loyalty New Zealand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dalli
|
@@ -556,7 +556,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
556
556
|
version: '0'
|
557
557
|
requirements: []
|
558
558
|
rubyforge_project:
|
559
|
-
rubygems_version: 2.
|
559
|
+
rubygems_version: 2.7.7
|
560
560
|
signing_key:
|
561
561
|
specification_version: 4
|
562
562
|
summary: Opinionated APIs
|