expedia_api 0.1.5 → 0.1.6

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: 0da50e33f4a9d4c911cb1fa3b1df5106178e66d6
4
- data.tar.gz: 85b2d37398312d26228048b3f680bfe10670dfea
3
+ metadata.gz: 3b2e963a92b9fb5748913fa71a88baeb90a09cac
4
+ data.tar.gz: eff17ac196c142285af7d1c0fe03ebccfc5a532f
5
5
  SHA512:
6
- metadata.gz: 4b05b8e761cf8f27b0ecd742eff881bf62dd9a1a5526a7aedf28b005c028d07b5b107b2441046c26caffcf53129798ce79cf192113763c7c43398c3da96ceaee
7
- data.tar.gz: 309a8b2d536b18de94acc11a4d9a5b25c38a07e001e4749573e18c0fb7ba0d991abce8db2bc43ca311a57164cd5324563c936fb3e2561d6b7b1eec5889bf6aae
6
+ metadata.gz: 2e86a0518e2c89db58511d7dd372acc777ef857dfbbe6bfba73effb04b17b3e8ff7c2d1053a02aa150ba96e6f204133be0bd7ebcc6087f4ad850936b20b9ed11
7
+ data.tar.gz: 6d607f38dd76980073eb06bfbe6ba83b4c415d6fdec3dae7283739893ee5b480919ad85f646b801039b0b6ecb4f89d3f9e723ac2ee54e75d25844646ede90fce
@@ -24,8 +24,12 @@ module ExpediaApi
24
24
 
25
25
  # returns hotels for each hotel in the json
26
26
  def extract_hotels(hotels_json)
27
- hotels_json.map do |hotel|
28
- ExpediaApi::Entities::PackageHotel.new(hotel)
27
+ if hotels_json.is_a?(Array)
28
+ hotels_json.map do |hotel|
29
+ ExpediaApi::Entities::PackageHotel.new(hotel)
30
+ end
31
+ else
32
+ [ExpediaApi::Entities::PackageHotel.new(hotels_json)]
29
33
  end
30
34
  end
31
35
 
@@ -33,6 +37,8 @@ module ExpediaApi
33
37
  def extract_packages(json, flights:, hotels:)
34
38
  flights_by_index = flights.map {|flight| [flight.index, flight]}.to_h
35
39
  hotels_by_index = hotels.map {|hotel| [hotel.index, hotel]}.to_h
40
+ # if only one package is returned, we just get a hash, no array.
41
+ json = [json] if json.is_a?(Hash)
36
42
  json.map do |package|
37
43
  entity = ExpediaApi::Entities::Package.new(package)
38
44
  entity.flight = flights_by_index[entity.flight_index]
@@ -1,3 +1,3 @@
1
1
  module ExpediaApi
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expedia_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Kleinwaechter
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-20 00:00:00.000000000 Z
11
+ date: 2016-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler