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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af582661b851880a278f82844f06ec98910f639cf0292ec1249f1ed1127b0a27
4
- data.tar.gz: 5740b928ced7a2d9f4964388dbd5e543cbb0827c571f562899ab3a651a030f43
3
+ metadata.gz: 327163b30ae7b807b87a78479bc2cf6944a30d0fbc98d8c0156aaf557fd55445
4
+ data.tar.gz: dd84394527eb5bccfa256e2b59d4ed27a172ad7fffec9e1dcd5f83d46d8bd0de
5
5
  SHA512:
6
- metadata.gz: dd740314950b62480828dc4878a603582edd4bf00c6bddc7e7a6b694707b90da52fd2e31ccdf226b86afeff09aeccd0a12d94b900f322a1e153a3e5a48ce9515
7
- data.tar.gz: e535fb7f7655cbf975424497a333292d1dae97c9c8cb3f0621fac118f6e694d360dd355250f1ab91427144038c6a009392c37a0c47a64b4a9536b34a223a6582
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 ? current_result_set.pages.next : self.result_set.pages.next
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module FrederickAPI
4
4
  # Current gem version
5
- VERSION = '0.9'
5
+ VERSION = '0.10'
6
6
  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.9'
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: 2021-06-11 00:00:00.000000000 Z
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.8
82
+ rubygems_version: 3.0.9
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Frederick API Client