amadeus 3.3.0 → 4.0.0

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
  SHA256:
3
- metadata.gz: ec95cf5f3ba9c2cc68cca517f1feb2f9c2ab97ab61b8220338c619a3ca071b88
4
- data.tar.gz: 3c499ba802220e9e4b89e99276c6ff5481b6eaa4a7f7df4eaca73f18dfdcb07b
3
+ metadata.gz: 6de12964b5fc9ba2acc621f7c6cba612176f5a510d762c176a20bbaff97b696c
4
+ data.tar.gz: 7feadab2cb09cfcfb400a68d5b0e3574d7e26704cbf3b110675578116eb5bee1
5
5
  SHA512:
6
- metadata.gz: 7a10be7c20276302a2571a504f7724dc633b1bc9739bbbe0c8b63bcee3e1bf6011ec347cc9b83b4164dfdc41541b81b9dba89e2b0cc294d5c328723728e2ac34
7
- data.tar.gz: e7e802567729d52e770defbfa597a601bee86593b214798bee8cc201f9002e9333bbe7c9f05d8605083fc8ec8e3162acd43478a983ba96600361e99ecaf620fd
6
+ metadata.gz: eda4f4a0e74f46ab1ff6a7fd50943c98f25f3ab7cb09bfb2f9b9545fd36f906c658830ef38a1a3c8ce9129900226a9e303692156f3e12020effe5cc8499b8184
7
+ data.tar.gz: 335ede21e566eaa2d136c91f5a0408c9d22dbb53a8af7df05312645e0d3da3f4fa039ba65ec38b01e30d445c7861c8280dd438713476447de12c7abe8bcb27a8
@@ -1,4 +1,11 @@
1
1
  # Changelog
2
+ ## 4.0.0 - 2020-02-12
3
+ Release of the [Hotel Booking API](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-booking)
4
+
5
+ > The Amadeus Hotel Booking API lets you complete bookings at over 150,000 hotels and accommodations around the world. To complete bookings, you must first use the Amadeus Hotel Search API to search for hotel deals, select the desired offer and confirm the final price and availability. You can then use the Hotel Booking API to complete the reservation by providing an offer id, guest information and payment information.
6
+
7
+ Decommissioning of the `Flight Most Searched Destination API`
8
+
2
9
  ## 3.3.0 - 2019-11-12
3
10
  Release of the [Hotel Ratings](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-ratings)
4
11
 
data/README.md CHANGED
@@ -14,7 +14,7 @@ documentation](https://amadeus4dev.github.io/amadeus-ruby/) on
14
14
 
15
15
  ## Installation
16
16
 
17
- This gem requires Ruby 2.3+. You can install install it directly or via bundler.
17
+ This gem requires Ruby 2.4+. You can install install it directly or via bundler.
18
18
  #### Command line
19
19
  ```bash
20
20
  gem install amadeus
@@ -181,10 +181,10 @@ amadeus.shopping.flight_destinations.get(origin: 'MAD')
181
181
  amadeus.shopping.flight_dates.get(origin: 'MAD', destination: 'MUC')
182
182
 
183
183
  # Flight Low-fare Search
184
- amadeus.shopping.flight_offers.get(origin: 'NYC', destination: 'MAD', departureDate: '2019-08-01')
184
+ amadeus.shopping.flight_offers.get(origin: 'NYC', destination: 'MAD', departureDate: '2020-08-01')
185
185
 
186
186
  # Flight Choice Prediction / Be careful, this example combines 2 API calls: 1. Flight Low-fare Search then Flight Choice Prediction
187
- amadeus.shopping.flight_offers.prediction.post(amadeus.shopping.flight_offers.get(origin: 'NYC', destination: 'MAD', departureDate: '2020-01-01').body)
187
+ amadeus.shopping.flight_offers.prediction.post(amadeus.shopping.flight_offers.get(origin: 'NYC', destination: 'MAD', departureDate: '2020-11-01').body)
188
188
 
189
189
  # Flight Check-in Links
190
190
  amadeus.reference_data.urls.checkin_links.get(airlineCode: 'BA')
@@ -204,12 +204,6 @@ amadeus.reference_data.location('ALHR').get
204
204
  # Airport Nearest Relevant (for London)
205
205
  amadeus.reference_data.locations.airports.get(longitude: 0.1278, latitude: 51.5074)
206
206
 
207
- # Flight Most Searched Destinations
208
- # Get the most searched destinations from an origin
209
- amadeus.travel.analytics.air_traffic.searched.get(originCityCode: 'MAD', searchPeriod: '2017-08', marketCountryCode: 'ES')
210
- # How many people in Spain searched for a trip from Madrid to New-York in August 2017?
211
- amadeus.travel.analytics.air_traffic.searched_by_destination.get(originCityCode: 'MAD', destinationCityCode: 'NYC', searchPeriod: '2017-08', marketCountryCode: 'ES')
212
-
213
207
  # Flight Most Booked Destinations
214
208
  amadeus.travel.analytics.air_traffic.booked.get(originCityCode: 'MAD', period: '2017-08')
215
209
 
@@ -231,6 +225,10 @@ amadeus.shopping.hotel_offers_by_hotel.get(hotelId: 'IALONCHO')
231
225
  # Confirm the availability of a specific offer
232
226
  amadeus.shopping.hotel_offer('D5BEE9D0D08B6678C2F5FAD910DC110BCDA187D21D4FCE68ED423426D0A246BB').get
233
227
 
228
+ # Hotel Booking
229
+ # The offerId comes from the hotel_offer above
230
+ amadeus.booking.hotel_bookings.post(offerId, guests, payments)
231
+
234
232
  # Hotel Ratings
235
233
  # What are the reviews for the Holiday INN Manhattan and the Hilton London Paddington
236
234
  amadeus.e_reputation.hotel_sentiments.get(hotelIds: 'SJNYCAJA,TELONMFS')
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = '>= 2.2.0'
28
28
 
29
29
  spec.add_development_dependency 'awesome_print', '~> 1.8'
30
- spec.add_development_dependency 'bundler', '~> 2.0.1'
30
+ spec.add_development_dependency 'bundler', '~> 2.1.2'
31
31
  spec.add_development_dependency 'guard', '~> 2.14'
32
32
  spec.add_development_dependency 'guard-rake', '~> 1.0'
33
33
  spec.add_development_dependency 'guard-yard', '~> 2.2'
@@ -13,6 +13,7 @@ require 'amadeus/namespaces/travel'
13
13
  require 'amadeus/namespaces/shopping'
14
14
  require 'amadeus/namespaces/reference_data'
15
15
  require 'amadeus/namespaces/e_reputation'
16
+ require 'amadeus/namespaces/booking'
16
17
  require 'amadeus/namespaces/e_reputation/hotel_sentiments'
17
18
  require 'amadeus/namespaces/reference_data/airlines'
18
19
  require 'amadeus/namespaces/reference_data/urls'
@@ -33,9 +34,8 @@ require 'amadeus/namespaces/travel/analytics'
33
34
  require 'amadeus/namespaces/travel/analytics/air_traffic'
34
35
  require 'amadeus/namespaces/travel/analytics/air_traffic/traveled'
35
36
  require 'amadeus/namespaces/travel/analytics/air_traffic/booked'
36
- require 'amadeus/namespaces/travel/analytics/air_traffic/searched'
37
- require 'amadeus/namespaces/travel/analytics/air_traffic/searched_by_destination'
38
37
  require 'amadeus/namespaces/travel/analytics/air_traffic/busiest_period'
38
+ require 'amadeus/namespaces/booking/hotel_bookings'
39
39
 
40
40
  # The namespace for the files used to make API
41
41
  # calls to the Amadeus travel APIs
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amadeus
4
+ module Namespaces
5
+ # A namespaced client for the
6
+ # +/v1/booking+ endpoints
7
+ #
8
+ # Access via the +Amadeus::Client+ object
9
+ #
10
+ # amadeus = Amadeus::Client.new
11
+ # amadeus.booking
12
+ #
13
+ class Booking < Amadeus::Client::Decorator
14
+ # The namespace for the Booking APIs:
15
+ #
16
+ # @return [Amadeus::Namespaces::Booking::HotelBookings]
17
+ # @example
18
+ # amadeus.booking.hotel_bookings
19
+ #
20
+ def hotel_bookings
21
+ Amadeus::Namespaces::Booking::HotelBookings.new(client)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amadeus
4
+ module Namespaces
5
+ class Booking
6
+ # A namespaced client for the
7
+ # +/v1/booking/hotel_bookings+ endpoints
8
+ #
9
+ # Access via the +Amadeus::Client+ object
10
+ #
11
+ # amadeus = Amadeus::Client.new
12
+ # amadeus.booking.hotel_bookings
13
+ #
14
+ class HotelBookings < Amadeus::Client::Decorator
15
+ # Book a specific room
16
+ #
17
+ # The parameters guests and payments can be passed as dictionary
18
+ # or list of dictionaries. If they are dictionary in this method they are
19
+ # converted to a list of dictionaries.
20
+ #
21
+ # @option params [String] :hotelIds list of hotel ids separated by comas
22
+ # @return [Amadeus:Response] a parsed response
23
+ # @raise [Amadeus:Base] an exception if the call failed
24
+ # @example book for a hotel offer
25
+ # amadeus.booking.hotel_bookings.post(
26
+ # hotel_offer_id, guests, payments
27
+ # )
28
+ #
29
+ def post(hotel_offer_id, guests, payments)
30
+ body = prepare_body(hotel_offer_id, guests, payments)
31
+
32
+ client.post('/v1/booking/hotel-bookings', body.to_json)
33
+ end
34
+
35
+ def prepare_body(hotel_offer_id, guests, payments)
36
+ guests_info = [], pay_info = []
37
+
38
+ guests.is_a?(Array) ? guests_info.push(guests).flatten! : guests_info.push(guests)
39
+ payments.is_a?(Array) ? pay_info.push(payments).flatten! : pay_info.push(payments)
40
+
41
+ {
42
+ 'data' => {
43
+ 'offerId' => hotel_offer_id,
44
+ 'guests' => guests_info,
45
+ 'payments' => pay_info
46
+ }
47
+ }
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -37,6 +37,16 @@ module Amadeus
37
37
  Shopping.new(self)
38
38
  end
39
39
 
40
+ # The namespace for the booking APIs:
41
+ #
42
+ # @return [Amadeus::Namespaces::Booking]
43
+ # @example Some of the further namespaces available
44
+ # amadeus.booking.hotel_bookings
45
+ #
46
+ def booking
47
+ Booking.new(self)
48
+ end
49
+
40
50
  # The namespace for the travel analytics APIs:
41
51
  #
42
52
  # @return [Amadeus::Namespaces::Travel]
@@ -30,11 +30,11 @@ module Amadeus
30
30
  # @return [Amadeus::Response] a parsed response
31
31
  # @raise [Amadeus::Base] an exception if the call failed
32
32
  # @example Find the cheapest flight offers from New-York to Madrid,
33
- # for the first of August 2019
33
+ # for the first of August 2020
34
34
  # amadeus.shopping.flight_offers.get(
35
35
  # origin: 'NYC',
36
36
  # destination: 'MAD',
37
- # departureDate: '2019-08-01'
37
+ # departureDate: '2020-08-01'
38
38
  # )
39
39
  #
40
40
 
@@ -37,29 +37,6 @@ module Amadeus
37
37
  )
38
38
  end
39
39
 
40
- # The namespace for the Searched API:
41
- #
42
- # @return
43
- # [Amadeus::Namespaces::Travel::Analytics::AirTraffic::Searched]
44
- # @example
45
- # amadeus.travel.analytics.air_traffic.searched
46
- def searched
47
- Amadeus::Namespaces::Travel::Analytics::AirTraffic::Searched.new(
48
- client
49
- )
50
- end
51
-
52
- # The namespace for the SearchedByDestination API:
53
- #
54
- # @return
55
- # [Amadeus::Namespaces::Travel::Analytics::AirTraffic::SearchedByDestination]
56
- # @example
57
- # amadeus.travel.analytics.air_traffic.searched_by_destination
58
- def searched_by_destination
59
- Amadeus::Namespaces::Travel::Analytics::AirTraffic::SearchedByDestination
60
- .new(client)
61
- end
62
-
63
40
  # The namespace for the Busiest Period API:
64
41
  #
65
42
  # @return
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Amadeus
4
4
  # The current client version
5
- VERSION = '3.3.0'.freeze
5
+ VERSION = '4.0.0'.freeze
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amadeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amadeus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2019-11-12 00:00:00.000000000 Z
13
+ date: 2020-02-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: awesome_print
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 2.0.1
35
+ version: 2.1.2
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: 2.0.1
42
+ version: 2.1.2
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: guard
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -224,6 +224,8 @@ files:
224
224
  - lib/amadeus/client/response.rb
225
225
  - lib/amadeus/client/response/parser.rb
226
226
  - lib/amadeus/client/validator.rb
227
+ - lib/amadeus/namespaces/booking.rb
228
+ - lib/amadeus/namespaces/booking/hotel_bookings.rb
227
229
  - lib/amadeus/namespaces/core.rb
228
230
  - lib/amadeus/namespaces/e_reputation.rb
229
231
  - lib/amadeus/namespaces/e_reputation/hotel_sentiments.rb
@@ -249,8 +251,6 @@ files:
249
251
  - lib/amadeus/namespaces/travel/analytics/air_traffic.rb
250
252
  - lib/amadeus/namespaces/travel/analytics/air_traffic/booked.rb
251
253
  - lib/amadeus/namespaces/travel/analytics/air_traffic/busiest_period.rb
252
- - lib/amadeus/namespaces/travel/analytics/air_traffic/searched.rb
253
- - lib/amadeus/namespaces/travel/analytics/air_traffic/searched_by_destination.rb
254
254
  - lib/amadeus/namespaces/travel/analytics/air_traffic/traveled.rb
255
255
  - lib/amadeus/version.rb
256
256
  homepage: https://github.com/amadeus4dev/amadeus-ruby
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Amadeus
4
- module Namespaces
5
- class Travel
6
- class Analytics
7
- class AirTraffic
8
- # A namespaced client for the
9
- # +/v1/travel/analytics/air-traffic/searched+ endpoints
10
- #
11
- # Access via the +Amadeus::Client+ object
12
- #
13
- # amadeus = Amadeus::Client.new
14
- # amadeus.travel.analytics.air_traffic.searched
15
- #
16
- class Searched < Amadeus::Client::Decorator
17
- # Returns a list of air traffic reports, based on searches.
18
- #
19
- # @option params [String] :originCityCode
20
- # IATA code of the origin city -
21
- # e.g. MAD for Madrid - required
22
- # @option params [String] :marketCountryCode
23
- # IATA code of the country from which the searches were made -
24
- # e.g. ES for Spain - required
25
- # @option params [String] :searchPeriod when consumers
26
- # are searching -
27
- # in YYYY-MM format - required
28
- # @return [Amadeus::Response] a parsed response
29
- # @raise [Amadeus::Base] an exception if the call failed
30
- # @example Which were the most searched flight destinations
31
- # from Madrid in August 2017?
32
- # amadeus.travel.analytics.air_traffic.searched.get(
33
- # originCityCode: 'MAD',
34
- # searchPeriod: '2017-08',
35
- # marketCountryCode: 'ES'
36
- # )
37
- #
38
- def get(params = {})
39
- client.get('/v1/travel/analytics/air-traffic/searched', params)
40
- end
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Amadeus
4
- module Namespaces
5
- class Travel
6
- class Analytics
7
- class AirTraffic
8
- # A namespaced client for the
9
- # +/v1/travel/analytics/air-traffic/searched_by_destination+ endpoints
10
- #
11
- # Access via the +Amadeus::Client+ object
12
- #
13
- # amadeus = Amadeus::Client.new
14
- # amadeus.travel.analytics.air_traffic.searched_by_destination
15
- #
16
- class SearchedByDestination < Amadeus::Client::Decorator
17
- # Returns a list of air traffic reports,
18
- # based on searches for a dedicated destination.
19
- #
20
- # @option params [String] :originCityCode
21
- # IATA code of the origin city -
22
- # e.g. NCE for Nice - required
23
- # @option params [String] :destinationCityCode
24
- # IATA code of the destinaton city -
25
- # e.g. PAR for Paris - required
26
- # @option params [String] :marketCountryCode
27
- # IATA code of the country from which the searches were made -
28
- # e.g. FR for France - required
29
- # @option params [String] :searchPeriod when consumers
30
- # are searching -
31
- # in YYYY-MM format - required
32
- # @return [Amadeus::Response] a parsed response
33
- # @raise [Amadeus::Base] an exception if the call failed
34
- # @example How many people in Spain searched for a trip
35
- # from Madrid to New-York in August 2017?
36
- # amadeus.travel.analytics.air_traffic.searched_by_destination.get(
37
- # originCityCode: 'MAD',
38
- # destinationCityCode: 'NYC',
39
- # searchPeriod: '2017-08',
40
- # marketCountryCode: 'ES'
41
- # )
42
- #
43
- def get(params = {})
44
- client.get(
45
- '/v1/travel/analytics/air-traffic/searched/by-destination',
46
- params
47
- )
48
- end
49
- end
50
- end
51
- end
52
- end
53
- end
54
- end