suitcase 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -76,7 +76,8 @@ module Suitcase
76
76
  :location_description, :short_description,
77
77
  :hotel_in_destination, :proximity_distance,
78
78
  :property_description, :number_of_floors, :number_of_rooms,
79
- :deep_link, :tripadvisor_rating
79
+ :deep_link, :tripadvisor_rating, :general_policies,
80
+ :checkin_instructions, :general_policies
80
81
 
81
82
  # Internal: Initialize a new Hotel.
82
83
  #
@@ -211,15 +212,23 @@ module Suitcase
211
212
  # Returns a reformatted Hash with the specified accessors.
212
213
  def self.parse_information(parsed)
213
214
  handle_errors(parsed)
215
+
216
+ binding.pry
214
217
 
215
- summary = if parsed["hotelId"]
216
- parsed
217
- else
218
- parsed["HotelInformationResponse"]["HotelSummary"]
219
- end
218
+ if parsed["hotelId"]
219
+ summary = parsed
220
+ parsed_info = {}
221
+ else
222
+ res = parsed["HotelInformationResponse"]
223
+ summary = res["HotelSummary"]
224
+ parsed_info = {
225
+ general_policies: res["HotelDetails"]["hotelPolicy"],
226
+ checkin_instructions: res["HotelDetails"]["checkInInstructions"]
227
+ }
228
+ end
220
229
  proximity_distance = summary["proximityDistance"].to_s
221
230
  proximity_distance << summary["proximityUnit"].to_s
222
- parsed_info = {
231
+ parsed_info.merge!(
223
232
  id: summary["hotelId"],
224
233
  name: summary["name"],
225
234
  address: summary["address1"],
@@ -237,7 +246,7 @@ module Suitcase
237
246
  proximity_distance: proximity_distance,
238
247
  tripadvisor_rating: summary["tripAdvisorRating"],
239
248
  deep_link: summary["deepLink"]
240
- }
249
+ )
241
250
  parsed_info[:amenities] = parsed["HotelInformationResponse"]["PropertyAmenities"]["PropertyAmenity"].map do |x|
242
251
  Amenity.new(id: x["amenityId"], description: x["amenity"])
243
252
  end if parsed["HotelInformationResponse"]
@@ -353,6 +362,9 @@ module Suitcase
353
362
 
354
363
  parsed["HotelRoomAvailabilityResponse"]["HotelRoomResponse"].map do |raw_data|
355
364
  room_data = {}
365
+ room_data[:non_refundable] = raw_data["nonRefundable"]
366
+ room_data[:deposit_required] = raw_data["depositRequired"]
367
+ room_data[:cancellation_policy] = raw_data["cancellationPolicy"]
356
368
  room_data[:rate_code] = raw_data["rateCode"]
357
369
  room_data[:room_type_code] = raw_data["roomTypeCode"]
358
370
  room_data[:room_type_description] = raw_data["roomTypeDescription"]
@@ -372,6 +384,7 @@ module Suitcase
372
384
  room_data[:bed_types] = [raw_data["BedTypes"]["BedType"]].flatten.map do |x|
373
385
  BedType.new(id: x["@id"], description: x["description"])
374
386
  end if raw_data["BedTypes"] && raw_data["BedTypes"]["BedType"]
387
+
375
388
  Room.new(room_data)
376
389
  end
377
390
  end
@@ -8,7 +8,8 @@ module Suitcase
8
8
  :average_rate, :max_nightly_rate, :currency_code, :value_adds,
9
9
  :room_type_description, :price_breakdown, :total_price,
10
10
  :average_nightly_rate, :promo, :arrival, :departure, :rooms,
11
- :bed_types
11
+ :bed_types, :cancellation_policy, :non_refundable,
12
+ :deposit_required
12
13
 
13
14
  extend Helpers
14
15
 
@@ -1,3 +1,3 @@
1
1
  module Suitcase
2
- VERSION = "1.6.0"
2
+ VERSION = "1.6.1"
3
3
  end
@@ -90,5 +90,24 @@ describe Suitcase::Hotel do
90
90
  it "returns an Array of available Rooms" do
91
91
  @rooms.must_be_kind_of(Array)
92
92
  end
93
+
94
+ it "each room must contain a cancellation policy" do
95
+ @rooms.each do |r|
96
+ r.cancellation_policy.wont_be_nil
97
+ end
98
+ end
99
+
100
+ it "each room must contain the non_refundable option" do
101
+ @rooms.each do |r|
102
+ r.non_refundable.wont_be_nil
103
+ end
104
+ end
105
+
106
+ it "each room must contain the deposit_required" do
107
+ @rooms.each do |r|
108
+ r.deposit_required.wont_be_nil
109
+ end
110
+ binding.pry
111
+ end
93
112
  end
94
113
  end
@@ -15,21 +15,21 @@ Suitcase.configure do |config|
15
15
  end
16
16
 
17
17
  module Keys
18
- SUITCASE_PAYMENT_OPTION = Suitcase::Hotel::PaymentOption.find(currency_code: "USD")[0]
19
- CREDIT_CARD_NUMBER_TESTING = "1234123412341234"
18
+ SUITCASE_PAYMENT_OPTION = Suitcase::Hotel::PaymentOption.find(currency_code: "USD").find { |po| po.name =~ /Master/ }
19
+ CREDIT_CARD_NUMBER_TESTING = "5401999999999999"
20
20
  CREDIT_CARD_CVV_TESTING = "123"
21
- CREDIT_CARD_EXPIRATION_DATE_TESTING = "3/14"
21
+ CREDIT_CARD_EXPIRATION_DATE_TESTING = "2014/03/01"
22
22
 
23
23
  VALID_RESERVATION_INFO = {
24
24
  email: "testemail@gmail.com",
25
- first_name: "Test",
26
- last_name: "User",
25
+ first_name: "Test Booking",
26
+ last_name: "Test Booking",
27
27
  home_phone: "1231231234",
28
28
  payment_option: SUITCASE_PAYMENT_OPTION,
29
29
  credit_card_number: CREDIT_CARD_NUMBER_TESTING,
30
- credit_card_verification_code: "123",
30
+ credit_card_verification_code: CREDIT_CARD_CVV_TESTING,
31
31
  credit_card_expiration_date: CREDIT_CARD_EXPIRATION_DATE_TESTING,
32
- address1: "1 Some Place",
32
+ address1: "travelnow",
33
33
  city: "Boston",
34
34
  province: "MA",
35
35
  country: "US",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suitcase
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-17 00:00:00.000000000 Z
12
+ date: 2012-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest