expedia_api 0.1.4 → 0.1.5
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/client.rb +8 -3
- data/lib/expedia_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0da50e33f4a9d4c911cb1fa3b1df5106178e66d6
|
4
|
+
data.tar.gz: 85b2d37398312d26228048b3f680bfe10670dfea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b05b8e761cf8f27b0ecd742eff881bf62dd9a1a5526a7aedf28b005c028d07b5b107b2441046c26caffcf53129798ce79cf192113763c7c43398c3da96ceaee
|
7
|
+
data.tar.gz: 309a8b2d536b18de94acc11a4d9a5b25c38a07e001e4749573e18c0fb7ba0d991abce8db2bc43ca311a57164cd5324563c936fb3e2561d6b7b1eec5889bf6aae
|
data/lib/expedia_api/client.rb
CHANGED
@@ -91,19 +91,24 @@ module ExpediaApi
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def search_packages(hotel_ids: [], region_ids: [], from_date:, to_date:, from_airport:, to_airport:, other_options: {})
|
94
|
+
# convert/validate the parameters. the api expects a comma separated
|
95
|
+
# string.
|
96
|
+
hotel_ids = hotel_ids.join(",") if hotel_ids.is_a?(Array) && hotel_ids.any?
|
97
|
+
region_ids = region_ids.join(",") if region_ids.is_a?(Array) && region_ids.any?
|
94
98
|
validate_package_arguments({hotel_ids: hotel_ids, region_ids: region_ids})
|
95
|
-
parameters = {}
|
99
|
+
parameters = {}.merge(other_options)
|
96
100
|
parameters[:hotelids] = hotel_ids if hotel_ids.length
|
97
101
|
parameters[:regionids] = region_ids if region_ids.length
|
102
|
+
# build the url for the request to match the specifications
|
98
103
|
path_uri = build_package_search_request_path(from_airport: from_airport, to_airport: to_airport, from_date: from_date, to_date: to_date)
|
99
104
|
base_uri = "/wsapi/rest/package/v1/search"
|
100
105
|
full_uri = "#{base_uri}/#{path_uri}"
|
101
106
|
data = request(parameters: parameters, uri: full_uri)
|
102
107
|
ExpediaApi::ResponseLists::Packages.new(response: data)
|
103
108
|
rescue Faraday::ParsingError => e
|
104
|
-
ExpediaApi::
|
109
|
+
ExpediaApi::ResponseLists::Packages.new(exception: e)
|
105
110
|
rescue Faraday::ConnectionFailed => e
|
106
|
-
ExpediaApi::
|
111
|
+
ExpediaApi::ResponseLists::Packages.new(exception: e)
|
107
112
|
end
|
108
113
|
|
109
114
|
private
|
data/lib/expedia_api/version.rb
CHANGED