quicktravel_client 4.4.0 → 4.6.0

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: e129c681ca2ddcb9dd7e16bec7c20abf68d521e97772a014084eafff9012d59a
4
- data.tar.gz: 4b2616b1833da92d728e068855ef45d079dee130917d069dc0392fca3c4cf29a
3
+ metadata.gz: 6a4c632cfbc39ba8572be2c7639245838e24d9cb5cb182e6cf5447fb86d5d2c4
4
+ data.tar.gz: f2e51c60d7283dbeec9d0b6c0ce43569a5b65cbea9707781d5ffacbd78fa7a40
5
5
  SHA512:
6
- metadata.gz: 7583c89610fb8f7b5807446638dd0eac84773fc7007be819f6ef410121eca3a00bf6dba6db78373ea067804ae73fe39afa3951c15a9d9456ff7865167735367c
7
- data.tar.gz: 5ca4f5155bf9130c355c9a11620af95914e84276d382eff6f80b97a28fa98000ec055afc18c0f35ebbee6d9bec5f0a9a8ea9d0148c8a708b15b7e59644f60a13
6
+ metadata.gz: 9beee45dae9c6c32bf87276f1ef6ce859e4ee0cfb68f2c12011ec74efd96381cc71bb0261deb47b875665f9e78f814a4cdebe7a6ecbc610e27fe1412d851c622
7
+ data.tar.gz: bb5e864e91e579703a980facef1fbcb741b13314f3b25dd997379c730efadba52663df4bbac26498823b4f28d2d637763a794c41fec8d79e95ea6572fe57381e
@@ -5,8 +5,8 @@ jobs:
5
5
  strategy:
6
6
  fail-fast: false
7
7
  matrix:
8
- gemfile: [rails60, rails61]
9
- ruby: ["2.6", "2.7", "3.0"]
8
+ gemfile: [rails60, rails61, rails70]
9
+ ruby: ["3.0", "3.1", "3.2"]
10
10
  runs-on: ubuntu-latest
11
11
  env:
12
12
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.0
1
+ 3.2.0
data/CHANGELOG.md CHANGED
@@ -1,47 +1,75 @@
1
1
  # Change Log
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
  This project adheres to [Semantic Versioning](http://semver.org/).
4
5
  This changelog adheres to [Keep a CHANGELOG](http://keepachangelog.com/).
5
6
 
7
+ ## 4.6.0
8
+
9
+ - [PLAT-1175] Update to Ruby 3.2
10
+
11
+ ## 4.5.0
12
+
13
+ - [TT-9346] Support injection of additional headers in requests to quicktravel
14
+ - [TT-9331] Cache resources to reduce unnecessary API requests
15
+
6
16
  ## 4.4.0
17
+
7
18
  - [TT-8615] Update to build with github actions / ruby 3.0 / rails 6.1
8
19
 
9
20
  ## [4.3.2]
21
+
10
22
  ### Fixed
23
+
11
24
  - [TT-8511] Revert party lookup via the API endpoint
12
25
 
13
26
  ## [4.3.1]
27
+
14
28
  ### Fixed
29
+
15
30
  - [TT-8471] Fix missing QuickTravel:VERSION const error
16
31
 
17
32
  ## [4.3.0]
33
+
18
34
  ### Changed
35
+
19
36
  - [TT-8142] Add suitable user-agent header
20
37
  - [TT-8379] Switch to using api/parties endpoint
21
38
 
22
39
  ## [4.2.0]
40
+
23
41
  ### Changed
42
+
24
43
  - [TT-7969] Update cassettes to work with HttpParty >= 0.18.1
25
44
  - [TT-7912] Update api status endpoint to the new response format
26
45
 
27
46
  ## [4.1.0]
47
+
28
48
  ### Added
49
+
29
50
  - [TT-7788] Add API namespace to vehicle_types endpoint
30
51
 
31
52
  ## [4.0.0]
53
+
32
54
  - [TT-7385] Update Money dependency, test against Ruby 2.7 / Rails 6
33
55
 
34
56
  ## [3.9.0]
57
+
35
58
  ### Added
59
+
36
60
  - [DC-3115] Add customer comments method in booking
37
61
  - [DC-2942] Add package class to support quantity based package
38
62
 
39
63
  ## [3.8.1]
64
+
40
65
  ### Changed
66
+
41
67
  - [DC-3033] Reverse changes in checkout class to fix polipay redirection in EcomEngine
42
68
 
43
69
  ## [3.8.0]
70
+
44
71
  ### Added
72
+
45
73
  - [DC-1794] Update httparty to allow caching the whole response, also add namespace to cache key
46
74
  - [DC-1418] Port NRMA portal availability cache back to EcomEngine
47
75
  - [TT-4850] Added client templates
@@ -49,154 +77,217 @@ This changelog adheres to [Keep a CHANGELOG](http://keepachangelog.com/).
49
77
  - [TT-6246] Remove Booking.delete_reservations method
50
78
 
51
79
  ### Changed
80
+
52
81
  - [DC-2997] Remove API key from body, and move it to header
53
82
  - [DC-1767] include long/lat changes to Stop
54
83
 
55
84
  ## [3.7.0]
85
+
56
86
  ### Added
87
+
57
88
  - [DC-1437] Add relationship accesssor methods
58
89
  - [TT-3337] Add booking.delete_reservations method
59
90
  - [TT-3780] Add tests for Opal payments
60
91
  - [TT-3780] Add tests for Opal payment using create / update workflow
61
92
 
62
93
  ### Fixed
94
+
63
95
  - [TT-3304] Handle no response in booking update API
64
96
 
65
97
  ### Changed
98
+
66
99
  - [TT-3333] URL encode data sent to booking reference lookup
67
100
  - [TT-3783] Remove deprecated FixNum
68
101
  - [TT-3812] Update cassettes
69
102
 
70
103
  ## [3.6.0]
104
+
71
105
  ###
106
+
72
107
  - [ROT-114] Add drop off details
73
108
 
74
109
  ## [3.5.0]
110
+
75
111
  ###
112
+
76
113
  - [TT-3147] Remove unused payment methods
77
114
  - [TT-3278] Add full_response option to booking update
78
115
 
79
116
  ## [3.4.0]
117
+
80
118
  ###
119
+
81
120
  - Properties now return their associated location and types
82
121
 
83
122
  ## [3.3.0]
123
+
84
124
  ### Added
125
+
85
126
  - Price change reasons are now passed as an array
86
127
 
87
128
  ## [3.2.0]
129
+
88
130
  ### Changed
131
+
89
132
  - Return status with QuickTravel::AdapterError
90
133
 
91
134
  ## [3.1.0]
135
+
92
136
  ### Added
137
+
93
138
  - API to cancel a booking
94
139
 
95
140
  ## [3.0.0]
141
+
96
142
  ### Fixed
143
+
97
144
  - Allow zero pricing for extra pick items
98
145
 
99
146
  ### Changed
147
+
100
148
  - Use new reset password url
101
149
 
102
150
  ### Added
151
+
103
152
  - Setting API
104
153
 
105
154
  ### Removed
155
+
106
156
  - Removed geocode function on address
107
157
 
108
158
  ## [2.9.0]
159
+
109
160
  ### Changed
161
+
110
162
  - Use new API login
111
163
 
112
164
  ### Removed
165
+
113
166
  - Remove unused constants and default referral code
114
167
 
115
168
  ## [2.8.0]
169
+
116
170
  ### Changed
171
+
117
172
  - @booking.accommodation_reserve now expects to be passed the adjusted last_travel_date
118
173
 
119
174
  ## [2.7.0]
175
+
120
176
  ### Added
177
+
121
178
  - can_choose_stops? to check if a route has more than two stops
122
179
 
123
180
  ## [2.6.0]
181
+
124
182
  ### Removed
183
+
125
184
  - Stop passing last_travel_date
126
185
 
127
186
  ## [2.5.0]
187
+
128
188
  ### Added
189
+
129
190
  - Add call to get client token
130
191
 
131
192
  ## [2.4.1]
193
+
132
194
  ### Changed
195
+
133
196
  - Handle nil values for empty lists
134
197
 
135
198
  ## [2.4.0]
199
+
136
200
  ### Changed
201
+
137
202
  - Improve error handling when non JSON response
138
203
  - Update test cassettes due to API changes
139
204
  - Update test data due to new bootstrap.sql
140
205
 
141
206
  ## [2.3.1]
207
+
142
208
  ### Fixed
209
+
143
210
  - Omits empty array parameters
144
211
 
145
212
  ## [2.3.0]
213
+
146
214
  ### Changed
215
+
147
216
  - Change cache expiries
148
217
  - Adds support for passing dates to Resource#all_with_price
149
218
 
150
219
  ### Fixed
220
+
151
221
  - Fixes issue with HTTParty ~> 0.14
152
222
  - Updates HTTParty dependency to ~> 0.14
153
223
 
154
224
  ## [2.2.2]
225
+
155
226
  ### Changed
227
+
156
228
  - Deprecates Booking#calculate_price_quote
157
229
  - Fix when money is nil from QT
158
230
 
159
231
  ## [2.2.1] - 2016-04-18
232
+
160
233
  ### Fixed
234
+
161
235
  - Adds missing require for PriceQuote adapter
162
236
 
163
237
  ## [2.2.0] - 2016-04-18
238
+
164
239
  ### Added
240
+
165
241
  - PriceQuote adapter
166
242
 
167
243
  ## [2.1.0] - 2016-04-13
244
+
168
245
  ### Added
246
+
169
247
  - Resource categories
170
248
  - Products
171
249
 
172
250
  ## [2.0.0] - 2016-04-08
251
+
173
252
  ### Added
253
+
174
254
  - This changelog
175
255
  - Support for new ProductType API
176
256
 
177
257
  ### Changed
258
+
178
259
  - Discount API renamed Price Change API
179
260
  - Multiple internal refactorings and cleanups
180
261
  - Changes Price Quotes API to support non segment based products
181
262
 
182
263
  ## [1.1.1] - 2015-06-22
264
+
183
265
  ### Fixed
266
+
184
267
  - Fixed issue with Checkout API
185
268
 
186
269
  ## [1.1.0] - 2015-06-19
270
+
187
271
  ### Added
272
+
188
273
  - Checkout API
189
274
 
190
275
  ## [1.0.2] - 2015-06-01
276
+
191
277
  ### Fixed
278
+
192
279
  - Fixed issue with payment type code format
193
280
 
194
281
  ### Added
282
+
195
283
  - Code attribute to passenger type
196
284
 
197
285
  ## [1.0.1] - 2015-03-04
286
+
198
287
  ### Fixed
288
+
199
289
  - Fixed conflict between active_support and facets underscore method
200
290
 
201
291
  ## [1.0.0] - 2015-03-03
292
+
202
293
  - Initial public release
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+ gemspec :path => '../'
3
+
4
+ group :development, :test do
5
+ gem 'activesupport', '~> 7.0'
6
+ gem 'activerecord', '~> 7.0'
7
+ gem 'actionpack', '~> 7.0'
8
+ end
@@ -216,6 +216,7 @@ module QuickTravel
216
216
  http_params[:headers]['Content-length'] = '0' if http_params[:body].blank?
217
217
  http_params[:headers]['x-api-key'] = QuickTravel.config.access_key
218
218
  http_params[:headers]['user-agent'] = 'quicktravel_client/' + QuickTravel::VERSION;
219
+ http_params[:headers].merge!(extra_headers) if extra_headers
219
220
 
220
221
  expect = http_params.delete(:expect)
221
222
 
@@ -254,6 +255,10 @@ module QuickTravel
254
255
  response
255
256
  end
256
257
 
258
+ def self.extra_headers
259
+ QuickTravel.config.extra_headers
260
+ end
261
+
257
262
  # Do standard validations on response
258
263
  #
259
264
  # Firstly, check if a valid HTTP code was returned
@@ -2,7 +2,7 @@ require 'quick_travel/adapter'
2
2
 
3
3
  module QuickTravel
4
4
  class Configuration
5
- attr_accessor :url, :access_key, :version
5
+ attr_accessor :url, :access_key, :version, :extra_headers
6
6
 
7
7
  def url=(url)
8
8
  @url = url
@@ -11,6 +11,11 @@ module QuickTravel
11
11
  Resource.find_all!('/api/resources.json', parent_resource_id: @id)
12
12
  end
13
13
 
14
+ def self.find(id, opts = {})
15
+ opts = { cache_key: "resource:#{id}", cache_options: { expires_in: 1.hour } }.merge(opts)
16
+ super(id, opts)
17
+ end
18
+
14
19
  def self.all_with_price(opts)
15
20
  cache_key = GenerateCacheKey.new(name, opts).call
16
21
  find_all!("/api/resources/index_with_price.json", opts.merge(cache_key: cache_key))
@@ -1,3 +1,3 @@
1
1
  module QuickTravel
2
- VERSION = '4.4.0'
2
+ VERSION = '4.6.0'
3
3
  end
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
16
16
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
17
17
  spec.require_paths = ['lib']
18
- spec.required_ruby_version = '>= 2.6'
18
+ spec.required_ruby_version = '>= 3.0'
19
19
 
20
20
  spec.add_dependency 'httparty', '>= 0.18.1'
21
21
  spec.add_dependency 'activesupport', '>= 5.0.0'
@@ -30,7 +30,6 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'rspec-its'
31
31
  spec.add_development_dependency 'coverage-kit'
32
32
  spec.add_development_dependency 'simplecov-rcov'
33
- spec.add_development_dependency 'coveralls'
34
33
  spec.add_development_dependency 'stamp' # Used to send appropriate dates to API's
35
34
  spec.add_development_dependency 'vcr'
36
35
  spec.add_development_dependency 'webmock'
data/spec/adapter_spec.rb CHANGED
@@ -83,4 +83,28 @@ describe QuickTravel::Adapter do
83
83
  specify { expect(api).to have_received(:call_and_validate).twice }
84
84
  end
85
85
  end
86
+
87
+ context 'extra headers defined' do
88
+ let(:url) { 'http://test.quicktravel.com.au' }
89
+ let(:query) { {} }
90
+ let(:change_config) { }
91
+ let(:useragent) { 'rspec' }
92
+
93
+ before do
94
+ change_config
95
+ QuickTravel::Adapter.post_and_validate(url, query)
96
+ end
97
+
98
+ let(:expected_params) { a_hash_including(headers: a_hash_including('user-agent' => useragent)) }
99
+
100
+ specify { expect(QuickTravel::Api).to have_received(:post).with(url, expected_params) }
101
+
102
+ context 'and the config is changed' do
103
+ let(:useragent) { 'newspec' }
104
+ let(:change_config) {
105
+ QuickTravel.config.extra_headers = { 'user-agent' => 'newspec' }
106
+ }
107
+ specify { expect(QuickTravel::Api).to have_received(:post).with(url, expected_params) }
108
+ end
109
+ end
86
110
  end
data/spec/spec_helper.rb CHANGED
@@ -22,6 +22,7 @@ qt_keys = ENV['QT_KEYS'].split(',')
22
22
  QuickTravel.configure do |c|
23
23
  c.url = 'http://test.qt.sealink.com.au:8080'
24
24
  c.access_key = qt_keys[0]
25
+ c.extra_headers = { 'user-agent' => 'rspec' }
25
26
  end
26
27
 
27
28
  require 'quick_travel/connection_error'
@@ -1,4 +1,3 @@
1
1
  require 'simplecov-rcov'
2
- require 'coveralls'
3
2
  require 'coverage/kit'
4
- Coverage::Kit.setup(minimum_coverage: 83.2)
3
+ Coverage::Kit.setup(minimum_coverage: 83.7)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quicktravel_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 4.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Noack
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-01-06 00:00:00.000000000 Z
13
+ date: 2023-01-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -180,20 +180,6 @@ dependencies:
180
180
  - - ">="
181
181
  - !ruby/object:Gem::Version
182
182
  version: '0'
183
- - !ruby/object:Gem::Dependency
184
- name: coveralls
185
- requirement: !ruby/object:Gem::Requirement
186
- requirements:
187
- - - ">="
188
- - !ruby/object:Gem::Version
189
- version: '0'
190
- type: :development
191
- prerelease: false
192
- version_requirements: !ruby/object:Gem::Requirement
193
- requirements:
194
- - - ">="
195
- - !ruby/object:Gem::Version
196
- version: '0'
197
183
  - !ruby/object:Gem::Dependency
198
184
  name: stamp
199
185
  requirement: !ruby/object:Gem::Requirement
@@ -286,6 +272,7 @@ files:
286
272
  - examples/login_example.rb
287
273
  - gemfiles/rails60.gemfile
288
274
  - gemfiles/rails61.gemfile
275
+ - gemfiles/rails70.gemfile
289
276
  - lib/extensions.rb
290
277
  - lib/quick_travel.rb
291
278
  - lib/quick_travel/accommodation.rb
@@ -452,14 +439,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
452
439
  requirements:
453
440
  - - ">="
454
441
  - !ruby/object:Gem::Version
455
- version: '2.6'
442
+ version: '3.0'
456
443
  required_rubygems_version: !ruby/object:Gem::Requirement
457
444
  requirements:
458
445
  - - ">="
459
446
  - !ruby/object:Gem::Version
460
447
  version: '0'
461
448
  requirements: []
462
- rubygems_version: 3.2.3
449
+ rubygems_version: 3.4.1
463
450
  signing_key:
464
451
  specification_version: 4
465
452
  summary: Booking process using QuickTravel API