frederick_api 0.9 → 0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/frederick_api/v2/helpers/paginator.rb +13 -2
- data/lib/frederick_api/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 327163b30ae7b807b87a78479bc2cf6944a30d0fbc98d8c0156aaf557fd55445
|
4
|
+
data.tar.gz: dd84394527eb5bccfa256e2b59d4ed27a172ad7fffec9e1dcd5f83d46d8bd0de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c6109c022a72aacac5e95f66a315226732657b327eed72252ad6df76ed0cc2976e6adc0c1a573d47c5e8335eb6ce0a53401f3dfd9ebe13ab433f530b34a1f48
|
7
|
+
data.tar.gz: b818f0bcaf5a470ce4956e1337b5dd1f8f181fe52b5a30b1c86399d37e17282afa0a3d5dc62d8bd67d3819b55a3015d5824db8e28cb6e7df5252d6490297c05d
|
@@ -17,12 +17,11 @@ module FrederickAPI
|
|
17
17
|
|
18
18
|
(total_pages - current_page).times do
|
19
19
|
first_resource.class.with_headers(first_resource.custom_headers) do
|
20
|
-
current_result_set = current_result_set
|
20
|
+
current_result_set = next_result_set(current_result_set)
|
21
21
|
raise 'next link not found' unless current_result_set
|
22
22
|
results.push(*current_result_set.to_a)
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
26
25
|
results
|
27
26
|
end
|
28
27
|
|
@@ -47,6 +46,18 @@ module FrederickAPI
|
|
47
46
|
def current_page
|
48
47
|
params.fetch("page.#{page_param}", 1).to_i
|
49
48
|
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
# refetching the next link if no response is found.
|
53
|
+
def next_result_set(current_result_set)
|
54
|
+
if current_result_set
|
55
|
+
response = current_result_set.pages.next
|
56
|
+
response.present? ? response : current_result_set.pages.next
|
57
|
+
else
|
58
|
+
self.result_set.pages.next
|
59
|
+
end
|
60
|
+
end
|
50
61
|
end
|
51
62
|
end
|
52
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frederick_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.10'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frederick Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_api_client
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
|
-
rubygems_version: 3.0.
|
82
|
+
rubygems_version: 3.0.9
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: Frederick API Client
|