quicktravel_client 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a9774dc105f1e21dc676c4060db83a76948fa23
4
- data.tar.gz: cbf14887c78b49f66204f0d1ea59f366b913d368
3
+ metadata.gz: b2e1015f9b2425ca2fb20c0c15d06f895d310196
4
+ data.tar.gz: 272133e853af94bed1d5e1dbe82293ff98f81b36
5
5
  SHA512:
6
- metadata.gz: 781a93b8099cf7670dacb078671d71162552f9fb673d683923e69001f0420a4bda1fd9d95f91502d027e459443d075fe6fbc5f9d130d03e9ce85b07577c0e9db
7
- data.tar.gz: 31f516468e15eb1f0e043c5c00ffb07ab14657de943bf3ac8bb79661bba595dd13dfb5a1664360a166ce751ebb2df988b085f5df09951e0b78018c424d4e50e6
6
+ metadata.gz: 737903e12b279453e440bb6d7f2ba224a50a4bef462e23bae8ee856e175806fc2a61a6789202157be94df5963bcedafbbe418602be5b23c9afac67601e7a8072
7
+ data.tar.gz: 629b875210235abc2bf63869d5c5ad6fdd35eb72ca872a104e26df0e7aff5f072ef754e61c82fcf155455ec9071bbe62531cac55183e61a319d826b294dbfab9
@@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
  This changelog adheres to [Keep a CHANGELOG](http://keepachangelog.com/).
5
5
 
6
+ ## [2.2.0] - 2016-04-18
7
+ ### Added
8
+ - PriceQuote adapter
9
+
6
10
  ## [2.1.0] - 2016-04-13
7
11
  ### Added
8
12
  - Resource categories
@@ -0,0 +1,12 @@
1
+ require 'quick_travel/adapter'
2
+
3
+ module QuickTravel
4
+ class PriceQuote < Adapter
5
+ self.api_base = '/api/price_quotes'
6
+
7
+ def self.calculate(params)
8
+ response = post_and_validate("#{api_base}/calculate", params)
9
+ new(response)
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module QuickTravel
2
- VERSION = '2.1.0'
2
+ VERSION = '2.2.0'
3
3
  end
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ require 'quick_travel/price_quote'
4
+
5
+ describe QuickTravel::PriceQuote do
6
+ context 'when calculating' do
7
+ let(:reservation_params) {
8
+ { resource_id: 7, quantity: quantity, first_travel_date: '2016-04-15' }
9
+ }
10
+ let(:params) {
11
+ { reservations: [reservation_params] }
12
+ }
13
+ let(:price_quote) {
14
+ VCR.use_cassette('price_quote', record: :new_episodes) {
15
+ QuickTravel::PriceQuote.calculate(params)
16
+ }
17
+ }
18
+
19
+ context 'when no rules are applied' do
20
+ let(:quantity) { 2 }
21
+
22
+ specify { expect(price_quote.quoted_booking_gross.cents).to eq 6400 }
23
+ specify { expect(price_quote.applied_rules).to be_empty }
24
+ end
25
+
26
+ context 'when rules are applied' do
27
+ let(:quantity) { 3 }
28
+
29
+ specify { expect(price_quote.quoted_booking_gross.cents).to eq 4800 }
30
+ specify { expect(price_quote.applied_rules).to eq ['Special Offer'] }
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,119 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://test.qt.sealink.com.au:8080/api/price_quotes/calculate
6
+ body:
7
+ encoding: UTF-8
8
+ string: reservations[][resource_id]=7&reservations[][quantity]=2&reservations[][first_travel_date]=2016-04-15&access_key=<QT_KEY>
9
+ headers:
10
+ Content-Length:
11
+ - '0'
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: 'OK '
16
+ headers:
17
+ X-Frame-Options:
18
+ - SAMEORIGIN
19
+ X-Xss-Protection:
20
+ - '1'
21
+ X-Content-Type-Options:
22
+ - nosniff
23
+ X-Download-Options:
24
+ - noopen
25
+ X-Permitted-Cross-Domain-Policies:
26
+ - none
27
+ P3p:
28
+ - CP="IDC DSP CAO COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
29
+ Content-Type:
30
+ - application/json; charset=utf-8
31
+ X-Ua-Compatible:
32
+ - IE=Edge
33
+ Etag:
34
+ - '"a06812777482200ad2e57474ab6eb025"'
35
+ Cache-Control:
36
+ - max-age=0, private, must-revalidate
37
+ X-Request-Id:
38
+ - 5c9f2014cfcc01cdbb680ebb7d03fac7
39
+ X-Runtime:
40
+ - '0.739828'
41
+ Vary:
42
+ - Origin
43
+ Date:
44
+ - Mon, 18 Apr 2016 02:03:51 GMT
45
+ X-Rack-Cache:
46
+ - invalidate, pass
47
+ Server:
48
+ - WEBrick/1.3.1 (Ruby/2.2.4/2015-12-16)
49
+ Content-Length:
50
+ - '57'
51
+ Connection:
52
+ - Keep-Alive
53
+ Set-Cookie:
54
+ - _session_id=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJTNjM2JmOTFmMWY5YTFmZWZkOTE5ZTg1ODEzOGM5YjgyBjsAVEkiCXVzZXIGOwBGaQY%3D--90ec9a422ed33f83f756234b924f2ef31d0d3eb6;
55
+ path=/; HttpOnly
56
+ body:
57
+ encoding: UTF-8
58
+ string: '{"quoted_booking_gross_in_cents":6400,"applied_rules":[]}'
59
+ http_version:
60
+ recorded_at: Mon, 18 Apr 2016 02:03:51 GMT
61
+ - request:
62
+ method: post
63
+ uri: http://test.qt.sealink.com.au:8080/api/price_quotes/calculate
64
+ body:
65
+ encoding: UTF-8
66
+ string: reservations[][resource_id]=7&reservations[][quantity]=3&reservations[][first_travel_date]=2016-04-15&access_key=<QT_KEY>
67
+ headers:
68
+ Content-Length:
69
+ - '0'
70
+ response:
71
+ status:
72
+ code: 200
73
+ message: 'OK '
74
+ headers:
75
+ X-Frame-Options:
76
+ - SAMEORIGIN
77
+ X-Xss-Protection:
78
+ - '1'
79
+ X-Content-Type-Options:
80
+ - nosniff
81
+ X-Download-Options:
82
+ - noopen
83
+ X-Permitted-Cross-Domain-Policies:
84
+ - none
85
+ P3p:
86
+ - CP="IDC DSP CAO COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
87
+ Content-Type:
88
+ - application/json; charset=utf-8
89
+ X-Ua-Compatible:
90
+ - IE=Edge
91
+ Etag:
92
+ - '"be8282fde5fb52a677b61d1c7d5706a6"'
93
+ Cache-Control:
94
+ - max-age=0, private, must-revalidate
95
+ X-Request-Id:
96
+ - dd2ef3d004966a8b8f98e24d6ed7fb57
97
+ X-Runtime:
98
+ - '0.148945'
99
+ Vary:
100
+ - Origin
101
+ Date:
102
+ - Mon, 18 Apr 2016 02:03:51 GMT
103
+ X-Rack-Cache:
104
+ - invalidate, pass
105
+ Server:
106
+ - WEBrick/1.3.1 (Ruby/2.2.4/2015-12-16)
107
+ Content-Length:
108
+ - '72'
109
+ Connection:
110
+ - Keep-Alive
111
+ Set-Cookie:
112
+ - _session_id=BAh7B0kiD3Nlc3Npb25faWQGOgZFVEkiJWVhMzI2MDY3NzQzYTgzMGExNTZlNzA2MGVmZGU1OGIzBjsAVEkiCXVzZXIGOwBGaQY%3D--bd5584b319f12bae6e3ca2fafe54a041c3655522;
113
+ path=/; HttpOnly
114
+ body:
115
+ encoding: UTF-8
116
+ string: '{"quoted_booking_gross_in_cents":4800,"applied_rules":["Special Offer"]}'
117
+ http_version:
118
+ recorded_at: Mon, 18 Apr 2016 02:03:51 GMT
119
+ recorded_with: VCR 3.0.1
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: 2.1.0
4
+ version: 2.2.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: 2016-04-13 00:00:00.000000000 Z
13
+ date: 2016-04-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: httparty
@@ -315,6 +315,7 @@ files:
315
315
  - lib/quick_travel/price_changes/booking_price_change.rb
316
316
  - lib/quick_travel/price_changes/price_change.rb
317
317
  - lib/quick_travel/price_changes/price_change_tree.rb
318
+ - lib/quick_travel/price_quote.rb
318
319
  - lib/quick_travel/product.rb
319
320
  - lib/quick_travel/product_configuration.rb
320
321
  - lib/quick_travel/product_passenger_search_criteria.rb
@@ -346,6 +347,7 @@ files:
346
347
  - spec/discounts_spec.rb
347
348
  - spec/passenger_type_spec.rb
348
349
  - spec/payment_type_spec.rb
350
+ - spec/price_quote_spec.rb
349
351
  - spec/product_spec.rb
350
352
  - spec/product_type_spec.rb
351
353
  - spec/products/scheduled_trip_spec.rb
@@ -374,6 +376,7 @@ files:
374
376
  - spec/support/cassettes/create_reservation_with_booking.yml
375
377
  - spec/support/cassettes/passenger_all.yml
376
378
  - spec/support/cassettes/payment_info.yml
379
+ - spec/support/cassettes/price_quote.yml
377
380
  - spec/support/cassettes/product_date_range_bookability.yml
378
381
  - spec/support/cassettes/product_show.yml
379
382
  - spec/support/cassettes/product_show_as_agent.yml
@@ -424,6 +427,7 @@ test_files:
424
427
  - spec/discounts_spec.rb
425
428
  - spec/passenger_type_spec.rb
426
429
  - spec/payment_type_spec.rb
430
+ - spec/price_quote_spec.rb
427
431
  - spec/product_spec.rb
428
432
  - spec/product_type_spec.rb
429
433
  - spec/products/scheduled_trip_spec.rb
@@ -452,6 +456,7 @@ test_files:
452
456
  - spec/support/cassettes/create_reservation_with_booking.yml
453
457
  - spec/support/cassettes/passenger_all.yml
454
458
  - spec/support/cassettes/payment_info.yml
459
+ - spec/support/cassettes/price_quote.yml
455
460
  - spec/support/cassettes/product_date_range_bookability.yml
456
461
  - spec/support/cassettes/product_show.yml
457
462
  - spec/support/cassettes/product_show_as_agent.yml