quiz_api_client 2.4.1 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docker-compose.dev.override.yml +1 -1
- data/lib/quiz_api_client/http_client.rb +22 -6
- data/lib/quiz_api_client/version.rb +1 -1
- data/quiz_api_client.gemspec +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 019fb5be46485bfe51fa89b86e237dd860dde74f
|
4
|
+
data.tar.gz: cb8c846ad17c8c6d54e21e316d0f9bab8ffe17f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7f0d24d1b650dadf17a88bffc65439b741bc855d4c3d85cf8381d84d3ecb4e6a3832cac96324c7e5b348d1777c596e9fb1afcb496d1d4c1b7bfde8d19a6e473
|
7
|
+
data.tar.gz: 6de74ac09879a9d567de198d6c316ae96548df3f6b15f538bc7cec3ca173ad82f036577dc704d44eb1f76951229f930165180f33a45bc02cd68d8616fcb690c1
|
@@ -81,14 +81,14 @@ module QuizApiClient
|
|
81
81
|
raise RequestFailed, e.message
|
82
82
|
end
|
83
83
|
|
84
|
-
def make_paginated_request(method, url,
|
84
|
+
def make_paginated_request(method, url, options)
|
85
85
|
entities = []
|
86
|
-
request_url = url
|
86
|
+
request_url, request_options = url, options
|
87
87
|
|
88
88
|
until request_url.nil? do
|
89
89
|
resp = make_request(method, request_url, request_options)
|
90
90
|
entities.concat(resp.parsed_response)
|
91
|
-
request_url = next_page(resp)
|
91
|
+
request_url, request_options = next_page(resp, url, options)
|
92
92
|
end
|
93
93
|
entities
|
94
94
|
end
|
@@ -109,11 +109,27 @@ module QuizApiClient
|
|
109
109
|
initial_hash
|
110
110
|
end
|
111
111
|
|
112
|
-
def next_page(response)
|
113
|
-
|
112
|
+
def next_page(response, url, options)
|
113
|
+
next_page_link(response, options) || next_page_dynamo(response, url, options)
|
114
|
+
end
|
114
115
|
|
116
|
+
def next_page_link(response, options)
|
117
|
+
return unless response.headers['link'].present?
|
118
|
+
links = LinkHeader.parse(response.headers['link']).links
|
115
119
|
next_link = links.find { |link| link['rel'] == 'next' }
|
116
|
-
next_link.href if next_link
|
120
|
+
[next_link.href, options] if next_link
|
121
|
+
end
|
122
|
+
|
123
|
+
def next_page_dynamo(response, url, options)
|
124
|
+
hash_key = response.headers['x-last-evaluated-hash-key']
|
125
|
+
range_key = response.headers['x-last-evaluated-range-key']
|
126
|
+
return unless hash_key.present? && range_key.present?
|
127
|
+
|
128
|
+
query = (options[:query] || {}).merge(
|
129
|
+
last_evaluated_hash_key: hash_key,
|
130
|
+
last_evaluated_range_key: range_key
|
131
|
+
)
|
132
|
+
[ url, options.merge(query: query) ]
|
117
133
|
end
|
118
134
|
end
|
119
135
|
end
|
data/quiz_api_client.gemspec
CHANGED
@@ -48,8 +48,8 @@ Gem::Specification.new do |spec|
|
|
48
48
|
spec.add_development_dependency 'bundler', '~> 1.12'
|
49
49
|
spec.add_development_dependency 'simplecov'
|
50
50
|
spec.add_development_dependency 'webmock'
|
51
|
-
spec.add_development_dependency 'pact', '~> 1.
|
52
|
-
spec.add_development_dependency 'pact_broker-client', '~> 1.
|
51
|
+
spec.add_development_dependency 'pact', '~> 1.19.2'
|
52
|
+
spec.add_development_dependency 'pact_broker-client', '~> 1.13.1'
|
53
53
|
spec.add_development_dependency 'rake', '~> 10.0'
|
54
54
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
55
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quiz_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wang
|
@@ -19,7 +19,7 @@ authors:
|
|
19
19
|
autorequire:
|
20
20
|
bindir: exe
|
21
21
|
cert_chain: []
|
22
|
-
date: 2017-
|
22
|
+
date: 2017-12-07 00:00:00.000000000 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: httparty
|
@@ -111,28 +111,28 @@ dependencies:
|
|
111
111
|
requirements:
|
112
112
|
- - "~>"
|
113
113
|
- !ruby/object:Gem::Version
|
114
|
-
version: 1.
|
114
|
+
version: 1.19.2
|
115
115
|
type: :development
|
116
116
|
prerelease: false
|
117
117
|
version_requirements: !ruby/object:Gem::Requirement
|
118
118
|
requirements:
|
119
119
|
- - "~>"
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version: 1.
|
121
|
+
version: 1.19.2
|
122
122
|
- !ruby/object:Gem::Dependency
|
123
123
|
name: pact_broker-client
|
124
124
|
requirement: !ruby/object:Gem::Requirement
|
125
125
|
requirements:
|
126
126
|
- - "~>"
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version: 1.
|
128
|
+
version: 1.13.1
|
129
129
|
type: :development
|
130
130
|
prerelease: false
|
131
131
|
version_requirements: !ruby/object:Gem::Requirement
|
132
132
|
requirements:
|
133
133
|
- - "~>"
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version: 1.
|
135
|
+
version: 1.13.1
|
136
136
|
- !ruby/object:Gem::Dependency
|
137
137
|
name: rake
|
138
138
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
233
|
version: '0'
|
234
234
|
requirements: []
|
235
235
|
rubyforge_project:
|
236
|
-
rubygems_version: 2.
|
236
|
+
rubygems_version: 2.6.13
|
237
237
|
signing_key:
|
238
238
|
specification_version: 4
|
239
239
|
summary: Ruby client for quiz_api
|