expedia_api 0.1.4 → 0.1.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1fe7e96bee4a14c1f2667b22eb9da9f5445e5b8
4
- data.tar.gz: 2d5f8165948ef02e8de35ce24698b2c4126829fa
3
+ metadata.gz: 0da50e33f4a9d4c911cb1fa3b1df5106178e66d6
4
+ data.tar.gz: 85b2d37398312d26228048b3f680bfe10670dfea
5
5
  SHA512:
6
- metadata.gz: d04cde9d1f73bbadc2d939339a4393eccf50ce33fca9504b0b129588ad2ef6691878339e70e83ad918234e27bdea3231f867ea44bdb2497fc44ec87fadd8d458
7
- data.tar.gz: d1d264980a237298402a4901d1dc2b2089396887338fbcac11a0b490c2c0b2d51f69cffe5dcb4f005ce3f25f881cc8fc41f2ba67ae15ab031bb7294ec5f03cba
6
+ metadata.gz: 4b05b8e761cf8f27b0ecd742eff881bf62dd9a1a5526a7aedf28b005c028d07b5b107b2441046c26caffcf53129798ce79cf192113763c7c43398c3da96ceaee
7
+ data.tar.gz: 309a8b2d536b18de94acc11a4d9a5b25c38a07e001e4749573e18c0fb7ba0d991abce8db2bc43ca311a57164cd5324563c936fb3e2561d6b7b1eec5889bf6aae
@@ -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::PackageResponseList.new(exception: e)
109
+ ExpediaApi::ResponseLists::Packages.new(exception: e)
105
110
  rescue Faraday::ConnectionFailed => e
106
- ExpediaApi::PackageResponseList.new(exception: e)
111
+ ExpediaApi::ResponseLists::Packages.new(exception: e)
107
112
  end
108
113
 
109
114
  private
@@ -1,3 +1,3 @@
1
1
  module ExpediaApi
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expedia_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Kleinwaechter