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 +4 -4
- data/lib/expedia_api/response_lists/packages.rb +8 -2
- data/lib/expedia_api/version.rb +1 -1
- 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: 3b2e963a92b9fb5748913fa71a88baeb90a09cac
|
4
|
+
data.tar.gz: eff17ac196c142285af7d1c0fe03ebccfc5a532f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
28
|
-
|
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]
|
data/lib/expedia_api/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|