hotel_beds 0.6.0 → 0.6.1
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 +4 -4
- data/lib/hotel_beds/model/available_room.rb +1 -2
- data/lib/hotel_beds/model/hotel_service.rb +0 -1
- data/lib/hotel_beds/parser/available_room.rb +3 -5
- data/lib/hotel_beds/parser/hotel_service.rb +0 -1
- data/lib/hotel_beds/parser.rb +9 -2
- data/lib/hotel_beds/version.rb +1 -1
- data/spec/features/ordering_a_hotel_room_spec.rb +52 -10
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c13c4cc2853463a5efd1eb7a84706e97ba99a657
|
|
4
|
+
data.tar.gz: f1028bf38d8d34b2d125c9cdb802d39deddbe3ca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b7967f82acbd3bcd8660d37748b6bc83eaacdbd6356896492f6dcc55b09a0c530700d5374ded1c8d7cf2e3e0b06134b1720d58e6b3e805567aab9ea55892ff46
|
|
7
|
+
data.tar.gz: 1809bf53d2f77f5f5a9eaf68fc0f6134d4b00c64932390474fbed49ba019aad3bd52da1b4f5b226b28e838632ba5fbc286f0509f5748a146cd4b0e79bc7799f0
|
|
@@ -17,8 +17,7 @@ module HotelBeds
|
|
|
17
17
|
attribute :price, BigDecimal
|
|
18
18
|
attribute :number_available, Integer
|
|
19
19
|
attribute :rates, Hash[Date => BigDecimal]
|
|
20
|
-
attribute :
|
|
21
|
-
default: Array.new
|
|
20
|
+
attribute :cancellation_policy, HotelBeds::Model::CancellationPolicy
|
|
22
21
|
attribute :customers, Array[HotelBeds::Model::Customer],
|
|
23
22
|
default: Array.new
|
|
24
23
|
|
|
@@ -20,11 +20,9 @@ module HotelBeds
|
|
|
20
20
|
attribute :room_type_code, selector: "HotelRoom RoomType", attr: "code"
|
|
21
21
|
attribute :room_type_characteristic,
|
|
22
22
|
selector: "HotelRoom RoomType", attr: "characteristic"
|
|
23
|
-
attribute :price
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
attribute :cancellation_policies,
|
|
27
|
-
selector: "HotelRoom CancellationPolicy", multiple: true,
|
|
23
|
+
attribute :price, selector: "HotelRoom > Price > Amount"
|
|
24
|
+
attribute :cancellation_policy,
|
|
25
|
+
selector: "HotelRoom CancellationPolicy",
|
|
28
26
|
parser: HotelBeds::Parser::CancellationPolicy
|
|
29
27
|
attribute :rates,
|
|
30
28
|
selector: "Price PriceList Price", multiple: true,
|
data/lib/hotel_beds/parser.rb
CHANGED
|
@@ -46,11 +46,18 @@ module HotelBeds
|
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
def attributes
|
|
49
|
-
@attributes ||=
|
|
49
|
+
@attributes ||= begin
|
|
50
|
+
super_class = ancestors[1]
|
|
51
|
+
if super_class.respond_to?(:attributes)
|
|
52
|
+
super_class.attributes
|
|
53
|
+
else
|
|
54
|
+
Array.new
|
|
55
|
+
end
|
|
56
|
+
end
|
|
50
57
|
end
|
|
51
58
|
|
|
52
59
|
protected def attribute(*args, &block)
|
|
53
|
-
|
|
60
|
+
attributes.push(Attribute.new(*args, &block))
|
|
54
61
|
end
|
|
55
62
|
|
|
56
63
|
def default_model_class(klass = nil)
|
data/lib/hotel_beds/version.rb
CHANGED
|
@@ -73,23 +73,65 @@ RSpec.describe "ordering a hotel room" do
|
|
|
73
73
|
@checkout_response = @checkout_operation.response
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
describe "basket response" do
|
|
77
|
+
let(:response) { @basket_response }
|
|
77
78
|
|
|
78
|
-
|
|
79
|
+
subject { response }
|
|
79
80
|
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
it "should be a success" do
|
|
82
|
+
expect(subject).to be_success
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
describe "#purchase" do
|
|
86
|
+
subject { response.purchase }
|
|
87
|
+
|
|
88
|
+
it "should have a service" do
|
|
89
|
+
expect(subject.services).to_not be_empty
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
describe "#purchase.services" do
|
|
94
|
+
subject { response.purchase.services }
|
|
95
|
+
|
|
96
|
+
it "should alway have a contract" do
|
|
97
|
+
subject.each do |service|
|
|
98
|
+
expect(service.contract).to_not be_nil
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
describe "#purchase.services.available_rooms" do
|
|
104
|
+
subject do
|
|
105
|
+
response.purchase.services.map(&:available_rooms).inject(Array.new, :+)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
it "should have a cancellation policy" do
|
|
109
|
+
subject.each do |room|
|
|
110
|
+
expect(room.cancellation_policy).to_not be_nil
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
82
114
|
end
|
|
83
115
|
|
|
84
|
-
describe "
|
|
85
|
-
|
|
116
|
+
describe "checkout response" do
|
|
117
|
+
let(:response) { @checkout_response }
|
|
86
118
|
|
|
87
|
-
|
|
88
|
-
|
|
119
|
+
subject { response }
|
|
120
|
+
|
|
121
|
+
it "should be a success" do
|
|
122
|
+
expect(subject).to be_success
|
|
89
123
|
end
|
|
90
124
|
|
|
91
|
-
|
|
92
|
-
|
|
125
|
+
describe "#purchase" do
|
|
126
|
+
subject { response.purchase }
|
|
127
|
+
|
|
128
|
+
it "should have a service" do
|
|
129
|
+
expect(subject.services).to_not be_empty
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
it "should have a agency reference" do
|
|
133
|
+
expect(subject.agency_reference).to eq(@agency_reference)
|
|
134
|
+
end
|
|
93
135
|
end
|
|
94
136
|
end
|
|
95
137
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hotel_beds
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ryan Townsend
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-08-
|
|
11
|
+
date: 2014-08-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: savon
|