hotel_beds 0.6.0 → 0.6.1

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: cf57f2506ec0688c5053d16cce8650d6482ad457
4
- data.tar.gz: 2443235be43ea5872b2cc8592298bb7a680328e4
3
+ metadata.gz: c13c4cc2853463a5efd1eb7a84706e97ba99a657
4
+ data.tar.gz: f1028bf38d8d34b2d125c9cdb802d39deddbe3ca
5
5
  SHA512:
6
- metadata.gz: 958490e3fb55593abbee5b656d880fa7b20ae91109922a9bb59c298b0c4951ac4c36cd17d7bd695d15dd125df04974704d54f1a36913fa8c775871812cb6bc2a
7
- data.tar.gz: 1677a0f5131a6f20bb3c52338a58078dc76271c51e2ffca668a02dc9e3ec8facee3a8ba1f0908c16291e219062b3152854865d2e29cf925b3e55089810521cc8
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 :cancellation_policies, Array[HotelBeds::Model::CancellationPolicy],
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
 
@@ -1,5 +1,4 @@
1
1
  require "hotel_beds/model/hotel"
2
- require "hotel_beds/model/contract"
3
2
 
4
3
  module HotelBeds
5
4
  module Model
@@ -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 do |element|
24
- ((element.at_css("HotelRoom") > "Price") > "Amount").first.content
25
- end
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,
@@ -1,5 +1,4 @@
1
1
  require "hotel_beds/parser/hotel"
2
- require "hotel_beds/parser/contract"
3
2
 
4
3
  module HotelBeds
5
4
  module Parser
@@ -46,11 +46,18 @@ module HotelBeds
46
46
  end
47
47
 
48
48
  def attributes
49
- @attributes ||= Array.new
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
- (@attributes ||= Array.new).push(Attribute.new(*args, &block))
60
+ attributes.push(Attribute.new(*args, &block))
54
61
  end
55
62
 
56
63
  def default_model_class(klass = nil)
@@ -1,3 +1,3 @@
1
1
  module HotelBeds
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
@@ -73,23 +73,65 @@ RSpec.describe "ordering a hotel room" do
73
73
  @checkout_response = @checkout_operation.response
74
74
  end
75
75
 
76
- let(:response) { @checkout_response }
76
+ describe "basket response" do
77
+ let(:response) { @basket_response }
77
78
 
78
- subject { response }
79
+ subject { response }
79
80
 
80
- it "should be a success" do
81
- expect(subject).to be_success
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 "#purchase" do
85
- subject { response.purchase }
116
+ describe "checkout response" do
117
+ let(:response) { @checkout_response }
86
118
 
87
- it "should have a service" do
88
- expect(subject.services).to_not be_empty
119
+ subject { response }
120
+
121
+ it "should be a success" do
122
+ expect(subject).to be_success
89
123
  end
90
124
 
91
- it "should have a agency reference" do
92
- expect(subject.agency_reference).to eq(@agency_reference)
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.0
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-10 00:00:00.000000000 Z
11
+ date: 2014-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: savon