suitcase 1.5.1 → 1.6.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.
@@ -1,4 +1,4 @@
1
- module Suitcase
1
+ module Suitcase
2
2
  # Public: An Exception to be raised from all EAN API-related errors.
3
3
  class EANException < Exception
4
4
  # Internal: Setter for the recovery information.
@@ -67,7 +67,7 @@
67
67
  wheelchair_accessible: 8,
68
68
  kitchen: 9
69
69
  }
70
-
70
+
71
71
  attr_accessor :id, :name, :address, :city, :province, :amenities,
72
72
  :masked_amenities, :country_code, :high_rate, :low_rate,
73
73
  :longitude, :latitude, :rating, :postal_code, :supplier_type,
@@ -266,10 +266,11 @@
266
266
  images = parsed["HotelInformationResponse"]["HotelImages"]["HotelImage"].map do |image_data|
267
267
  Suitcase::Image.new(image_data)
268
268
  end if parsed["HotelInformationResponse"] && parsed["HotelInformationResponse"]["HotelImages"] && parsed["HotelInformationResponse"]["HotelImages"]["HotelImage"]
269
+
269
270
  unless parsed["thumbNailUrl"].nil? or parsed["thumbNailUrl"].empty?
270
271
  images = [Suitcase::Image.new("thumbnailURL" => "http://images.travelnow.com" + parsed["thumbNailUrl"])]
271
272
  end
272
-
273
+
273
274
  images || []
274
275
  end
275
276
 
@@ -286,7 +287,14 @@
286
287
  if message =~ /Multiple locations/ && (info = info[key]["LocationInfos"])
287
288
  exception.type = :multiple_locations
288
289
  exception.recovery = {
289
- alternate_locations: info["LocationInfo"].map { |h| h["code"] }
290
+ alternate_locations: info["LocationInfo"].map do |info|
291
+ Location.new(
292
+ destination_id: info["destinationId"],
293
+ type: info["type"],
294
+ city: info["city"],
295
+ province: info["stateProvinceCode"]
296
+ )
297
+ end
290
298
  }
291
299
  end
292
300
 
@@ -328,7 +336,7 @@
328
336
  params.delete(:arrival)
329
337
  params.delete(:departure)
330
338
  params["hotelId"] = @id
331
-
339
+
332
340
  if Configuration.cache? and Configuration.cache.cached?(:avail, params)
333
341
  parsed = Configuration.cache.get_query(:avail, params)
334
342
  else
@@ -342,7 +350,7 @@
342
350
  rate_key = parsed["HotelRoomAvailabilityResponse"]["rateKey"]
343
351
  supplier_type = parsed["HotelRoomAvailabilityResponse"]["HotelRoomResponse"][0]["supplierType"]
344
352
  Hotel.update_session(parsed, info[:session])
345
-
353
+
346
354
  parsed["HotelRoomAvailabilityResponse"]["HotelRoomResponse"].map do |raw_data|
347
355
  room_data = {}
348
356
  room_data[:rate_code] = raw_data["rateCode"]
@@ -1,3 +1,3 @@
1
1
  module Suitcase
2
- VERSION = "1.5.1"
2
+ VERSION = "1.6.0"
3
3
  end
@@ -57,6 +57,9 @@ describe Suitcase::Hotel do
57
57
  Suitcase::Hotel.find(location: "Mexico")
58
58
  rescue Suitcase::EANException => e
59
59
  e.type.must_equal(:multiple_locations)
60
+ e.recovery.must_be_kind_of(Hash)
61
+ e.recovery[:alternate_locations].must_be_kind_of(Array)
62
+ e.recovery[:alternate_locations].first.must_be_kind_of(Suitcase::Hotel::Location)
60
63
  end
61
64
  end
62
65
  end
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.5.1
4
+ version: 1.6.0
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-03 00:00:00.000000000 Z
12
+ date: 2012-06-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest