quicktravel_client 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/quick_travel/price_changes/price_change.rb +2 -1
- data/lib/quick_travel/version.rb +1 -1
- data/spec/price_changes/price_change_spec.rb +48 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6c58e7c99c08a4166d8da17b97257f04ebcb1ce
|
4
|
+
data.tar.gz: 5dc43fbd765bf28d316bc0a8df6a2cf8844e0b7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4eac4455338f554d507ce042864e46ab4a928b02c2df5c5f32e2602ef7eae66e12e29478f6a7f1d1d01fd48dd1ed4807175c9801f18a692a980d4d531ee87d4
|
7
|
+
data.tar.gz: 3cf5e9b53a5312c53ff4816bf979073a368555bfd2550781b0cdb4eb225a7cc58eba8e02a7682f0ea0cb9ea89e916603b84ded0245aca15d0fae33d26352097c
|
data/CHANGELOG.md
CHANGED
@@ -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
|
+
## [3.3.0]
|
7
|
+
### Added
|
8
|
+
- Price change reasons are now passed as an array
|
9
|
+
|
6
10
|
## [3.2.0]
|
7
11
|
### Changed
|
8
12
|
- Return status with QuickTravel::AdapterError
|
@@ -2,7 +2,7 @@ module QuickTravel
|
|
2
2
|
module PriceChanges
|
3
3
|
class PriceChange
|
4
4
|
attr_reader :target
|
5
|
-
attr_reader :original_price, :changed_price, :price_change, :reason
|
5
|
+
attr_reader :original_price, :changed_price, :price_change, :reason, :reasons
|
6
6
|
|
7
7
|
delegate :positive?, :negative?, to: :price_change
|
8
8
|
|
@@ -13,6 +13,7 @@ module QuickTravel
|
|
13
13
|
@changed_price = Money.new(attrs.fetch('changed_price_in_cents'))
|
14
14
|
@price_change = Money.new(attrs.fetch('price_change_in_cents'))
|
15
15
|
@reason = attrs.fetch('reason')
|
16
|
+
@reasons = attrs.fetch('reasons', [@reason])
|
16
17
|
end
|
17
18
|
|
18
19
|
def applied_on?(id, type = 'Reservation')
|
data/lib/quick_travel/version.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'quick_travel/price_changes/price_change'
|
3
|
+
|
4
|
+
RSpec.describe QuickTravel::PriceChanges::PriceChange do
|
5
|
+
let(:attrs) { {
|
6
|
+
"target" => {
|
7
|
+
"type" => "Reservation",
|
8
|
+
"id" => 9915496
|
9
|
+
},
|
10
|
+
"original_price_in_cents" => 19600,
|
11
|
+
"changed_price_in_cents" => 18800,
|
12
|
+
"price_change_in_cents" => -800,
|
13
|
+
"reason" => "Online Discount and Special Price",
|
14
|
+
"reasons" => [
|
15
|
+
"Online Discount",
|
16
|
+
"Special Price"
|
17
|
+
],
|
18
|
+
"discounted_price_in_cents" => 18800,
|
19
|
+
"discount_in_cents" => -800,
|
20
|
+
"root" => {
|
21
|
+
"target" => {
|
22
|
+
"type" => "Reservation",
|
23
|
+
"id" => 9915496
|
24
|
+
},
|
25
|
+
"original_price_in_cents" => 19600,
|
26
|
+
"changed_price_in_cents" => 18800,
|
27
|
+
"price_change_in_cents" => -800,
|
28
|
+
"reason" => "Online Discount and Special Price",
|
29
|
+
"reasons" => [
|
30
|
+
"Online Discount",
|
31
|
+
"Special Price"
|
32
|
+
],
|
33
|
+
"discounted_price_in_cents" => 18800,
|
34
|
+
"discount_in_cents" => -800
|
35
|
+
},
|
36
|
+
"children" => []
|
37
|
+
} }
|
38
|
+
let(:price_change) { QuickTravel::PriceChanges::PriceChange.new(attrs) }
|
39
|
+
|
40
|
+
it 'should have the correct attributes' do
|
41
|
+
expect(price_change.target.type).to eq 'Reservation'
|
42
|
+
expect(price_change.original_price.cents).to eq 19600
|
43
|
+
expect(price_change.changed_price.cents).to eq 18800
|
44
|
+
expect(price_change.price_change.cents).to eq -800
|
45
|
+
expect(price_change.reason).to eq 'Online Discount and Special Price'
|
46
|
+
expect(price_change.reasons).to eq ['Online Discount', 'Special Price']
|
47
|
+
end
|
48
|
+
end
|
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: 3.
|
4
|
+
version: 3.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Noack
|
@@ -349,6 +349,7 @@ files:
|
|
349
349
|
- spec/discounts_spec.rb
|
350
350
|
- spec/passenger_type_spec.rb
|
351
351
|
- spec/payment_type_spec.rb
|
352
|
+
- spec/price_changes/price_change_spec.rb
|
352
353
|
- spec/price_quote_spec.rb
|
353
354
|
- spec/product_configuration_spec.rb
|
354
355
|
- spec/product_spec.rb
|
@@ -439,6 +440,7 @@ test_files:
|
|
439
440
|
- spec/discounts_spec.rb
|
440
441
|
- spec/passenger_type_spec.rb
|
441
442
|
- spec/payment_type_spec.rb
|
443
|
+
- spec/price_changes/price_change_spec.rb
|
442
444
|
- spec/price_quote_spec.rb
|
443
445
|
- spec/product_configuration_spec.rb
|
444
446
|
- spec/product_spec.rb
|