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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2a00510f91eb1597a6677ddd7db7342293cbead
4
- data.tar.gz: c1328d1480d86fa91731d575eadd820038ac51d5
3
+ metadata.gz: 019fb5be46485bfe51fa89b86e237dd860dde74f
4
+ data.tar.gz: cb8c846ad17c8c6d54e21e316d0f9bab8ffe17f4
5
5
  SHA512:
6
- metadata.gz: 1a3445f192bd75c78fdd3f42f46c2d254ab191bbb9e7c805b77da90244072b8d1467d0001af3591187f8257558bb1adb00e4d5e85c4018cbe180b77e33fc3d5e
7
- data.tar.gz: 7eb2997e14243ce80868d28995892c7aeb73f85807c16e3e6f98a1017f7dc33365c29199892c3d4fbd95a9669ff434d387cb99e0fd92ef6dfb0a2e501a143a71
6
+ metadata.gz: c7f0d24d1b650dadf17a88bffc65439b741bc855d4c3d85cf8381d84d3ecb4e6a3832cac96324c7e5b348d1777c596e9fb1afcb496d1d4c1b7bfde8d19a6e473
7
+ data.tar.gz: 6de74ac09879a9d567de198d6c316ae96548df3f6b15f538bc7cec3ca173ad82f036577dc704d44eb1f76951229f930165180f33a45bc02cd68d8616fcb690c1
@@ -8,7 +8,7 @@ services:
8
8
 
9
9
  contracts-testrunner:
10
10
  volumes:
11
- - .:/app
11
+ - .:/usr/src/app
12
12
  - bundler-config:/home/docker/.rvm/gems/ruby-2.4.0
13
13
 
14
14
  volumes:
@@ -81,14 +81,14 @@ module QuizApiClient
81
81
  raise RequestFailed, e.message
82
82
  end
83
83
 
84
- def make_paginated_request(method, url, request_options)
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
- links = LinkHeader.parse(response.headers['link']).links
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
@@ -1,3 +1,3 @@
1
1
  module QuizApiClient
2
- VERSION = '2.4.1'.freeze
2
+ VERSION = '2.4.2'.freeze
3
3
  end
@@ -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.16.0'
52
- spec.add_development_dependency 'pact_broker-client', '~> 1.6.0'
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.1
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-11-10 00:00:00.000000000 Z
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.16.0
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.16.0
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.6.0
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.6.0
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.5.1
236
+ rubygems_version: 2.6.13
237
237
  signing_key:
238
238
  specification_version: 4
239
239
  summary: Ruby client for quiz_api