amadeus 3.2.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -1
  3. data/README.md +52 -52
  4. data/amadeus.gemspec +12 -10
  5. data/lib/amadeus.rb +19 -4
  6. data/lib/amadeus/client/direction.rb +2 -4
  7. data/lib/amadeus/client/errors.rb +5 -4
  8. data/lib/amadeus/client/location.rb +2 -2
  9. data/lib/amadeus/client/request/hash.rb +1 -1
  10. data/lib/amadeus/namespaces/airport.rb +25 -0
  11. data/lib/amadeus/namespaces/airport/predictions.rb +27 -0
  12. data/lib/amadeus/namespaces/airport/predictions/on_time.rb +32 -0
  13. data/lib/amadeus/namespaces/analytics.rb +25 -0
  14. data/lib/amadeus/namespaces/analytics/itinerary_price_metrics.rb +38 -0
  15. data/lib/amadeus/namespaces/booking.rb +25 -0
  16. data/lib/amadeus/namespaces/booking/hotel_bookings.rb +52 -0
  17. data/lib/amadeus/namespaces/core.rb +50 -0
  18. data/lib/amadeus/namespaces/e_reputation.rb +25 -0
  19. data/lib/amadeus/namespaces/e_reputation/hotel_sentiments.rb +31 -0
  20. data/lib/amadeus/namespaces/reference_data/locations.rb +13 -1
  21. data/lib/amadeus/namespaces/reference_data/locations/point_of_interest.rb +44 -0
  22. data/lib/amadeus/namespaces/safety.rb +34 -0
  23. data/lib/amadeus/namespaces/safety/safety_rated_location.rb +32 -0
  24. data/lib/amadeus/namespaces/safety/safety_rated_locations.rb +46 -0
  25. data/lib/amadeus/namespaces/safety/safety_rated_locations/by_square.rb +41 -0
  26. data/lib/amadeus/namespaces/shopping.rb +4 -4
  27. data/lib/amadeus/namespaces/shopping/flight_offers_search.rb +61 -0
  28. data/lib/amadeus/namespaces/shopping/{flight_offers → flight_offers_search}/prediction.rb +7 -6
  29. data/lib/amadeus/namespaces/travel.rb +10 -1
  30. data/lib/amadeus/namespaces/travel/analytics/air_traffic.rb +0 -23
  31. data/lib/amadeus/namespaces/travel/predictions.rb +37 -0
  32. data/lib/amadeus/namespaces/travel/predictions/flight_delay.rb +55 -0
  33. data/lib/amadeus/namespaces/travel/predictions/trip_purpose.rb +46 -0
  34. data/lib/amadeus/version.rb +1 -1
  35. metadata +41 -26
  36. data/lib/amadeus/namespaces/shopping/flight_offers.rb +0 -47
  37. data/lib/amadeus/namespaces/travel/analytics/air_traffic/searched.rb +0 -46
  38. data/lib/amadeus/namespaces/travel/analytics/air_traffic/searched_by_destination.rb +0 -54
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 33afbcef68b900474c70352624925efda0d95a2cd97426bfa30297b736d94c5f
4
- data.tar.gz: bef8a5c017e946d1ed34af797ee40ddfdf7b389cc8784dfa1804cc3aa348f57d
3
+ metadata.gz: 1b5f631649abaae86acd4e45d35507a0863bcc1f60766d81f2264307c4e10a1a
4
+ data.tar.gz: c93ab739e245d2ab52ee50e5e2cde0700a7d2ac6a809cbcead2918f9c22987cf
5
5
  SHA512:
6
- metadata.gz: d239a6e9a1faf94826954eb219f8e790106e4b6c0f987c1752757042798aa9995ac84fe7cc9bea1a93454ce7e7e18606541d78a37cfa09cc03a473760a97dad7
7
- data.tar.gz: 9c41fcfd7266d6f74014a282bab7a1660daf0f532e7777a6ee7c8a140d84c94a698036a86fcdc214983a42f6e19674aa7920c55762d434acfd389d5f9e2b7331
6
+ metadata.gz: 1756d0de031d1c00f217d6483fa319810669850b500b95ee4a734255c59dca1368da89d02dc0b4fb74f8c4cb5183ca9ef43607696be2547cb73f8ae10e752918
7
+ data.tar.gz: 6d17996db303020e08566b6f38ba3b5e82005a616651a3688f39395b8e5779cc30778214de5b49f3b94592cc3512912fa902f3e1dbdf15780c4434ec22c05de4
data/CHANGELOG.md CHANGED
@@ -1,8 +1,35 @@
1
1
  # Changelog
2
+ ## 5.2.0 - 2021-03-20
3
+
4
+ Add support for Flight Price Analysis. Thanks [@developius](https://github.com/developius) for the contribution.
5
+ ## 5.1.0 - 2020-11-26
6
+
7
+ Add support for Safe Place API.
8
+ Add support for retrieve by id for Points Of Interest API
9
+ ## 5.0.0 - 2020-05-14
10
+ Release of the Flight Offers Search API.
11
+
12
+ Add support for the Flight Choice Prediction v2.
13
+
14
+ Decommission of the Flight Low-fare Search and Flight Choice Prediction v1.
15
+
16
+ ## 4.0.0 - 2020-02-12
17
+ Release of the [Hotel Booking API](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-booking)
18
+
19
+ > 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.
20
+
21
+ Decommissioning of the `Flight Most Searched Destination API`
22
+
23
+ ## 3.3.0 - 2019-11-12
24
+ Release of the [Hotel Ratings](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-ratings)
25
+
26
+ > The Hotel Ratings API uses a sentiment analysis algorithm to return an overall rating for a hotel as well as ratings for different criteria like location, comfort, service, staff, internet, food, facilities, pool or sleep quality. The ratings are on a scale of 0 to 100. The API is used to provide valuable content during the hotel search and shopping experience and permits hotel results to sorted by overall ratings or category ratings.
27
+
2
28
  ## 3.2.0 - 2019-05-08
3
29
  Release of the [Flight Choice Prediction API](https://developers.amadeus.com/self-service/category/air/api-doc/flight-choice-prediction)
4
30
 
5
31
  > The Flight Choice Prediction API allows developers to forecast traveler choices in the context of search & shopping. Exposing machine learning & AI services for travel, this API consumes the output of the Flight Low-fare Search API and returns augmented content with probabilities of choices for each flight offers.
32
+
6
33
  ## 3.1.0 - 2019-03-25
7
34
  Release of the [Point of Interest API](https://developers.amadeus.com/self-service/category/210/api-doc/55)
8
35
 
@@ -51,7 +78,7 @@ Release of the [Point of Interest API](https://developers.amadeus.com/self-servi
51
78
 
52
79
  ## 1.1.0 - 2018-08-01
53
80
 
54
- New version of the ruby gem to support our 3 new endpoints:
81
+ New version of the ruby gem to support our 3 new endpoints:
55
82
 
56
83
  * [Flight Most Booked Destinations](https://developers.amadeus.com/self-service/category/203/api-doc/27)
57
84
 
data/README.md CHANGED
@@ -5,16 +5,13 @@
5
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/d2e15221a502a7d71144/maintainability)](https://codeclimate.com/github/amadeus4dev/amadeus-ruby/maintainability)
6
6
  [![Dependencies](https://github.com/amadeus4dev/amadeus-ruby/raw/master/.github/images/dependencies.svg?sanitize=true)](gem)
7
7
  [![Contact Support](https://github.com/amadeus4dev/amadeus-ruby/raw/master/.github/images/support.svg?sanitize=true)][support]
8
+ [![Discord](https://img.shields.io/discord/696822960023011329?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/cVrFBqx)
8
9
 
9
- Amadeus provides a set of APIs for the travel industry. Flights, Hotels, Locations and more.
10
-
11
- For more details see the [Ruby
12
- documentation](https://amadeus4dev.github.io/amadeus-ruby/) on
13
- [Amadeus.com](https://developers.amadeus.com).
10
+ Amadeus provides a rich set of APIs for the travel industry. For more details, check out the [Amadeus for Developers Portal](https://developers.amadeus.com) or the [SDK class reference](https://amadeus4dev.github.io/amadeus-ruby/).
14
11
 
15
12
  ## Installation
16
13
 
17
- This gem requires Ruby 2.3+. You can install install it directly or via bundler.
14
+ This gem requires Ruby 2.5+. You can install it directly or via bundler.
18
15
  #### Command line
19
16
  ```bash
20
17
  gem install amadeus
@@ -26,9 +23,7 @@ gem 'amadeus'
26
23
 
27
24
  ## Getting Started
28
25
 
29
- To make your first API call you will need to [register for an Amadeus
30
- Developer Account](https://developers.amadeus.com/create-account) and set up
31
- your first application.
26
+ To make your first API call, you will need to [register](https://developers.amadeus.com/register) for an Amadeus Developer Account and [set up your first application](https://developers.amadeus.com/my-apps).
32
27
 
33
28
  ```rb
34
29
  require 'amadeus'
@@ -39,7 +34,7 @@ amadeus = Amadeus::Client.new({
39
34
  })
40
35
 
41
36
  begin
42
- puts amadeus.reference_data.urls.checkin_links.get({ airlineCode: 'BA' })
37
+ puts amadeus.shopping.flight_offers_search.get(originLocationCode: 'NYC', destinationLocationCode: 'MAD', departureDate: '2021-05-01', adults: 1, max: 1).body
43
38
  rescue Amadeus::ResponseError => error
44
39
  puts error
45
40
  end
@@ -54,19 +49,15 @@ The client can be initialized directly.
54
49
  amadeus = Amadeus::Client.new(client_id: 'REPLACE_BY_YOUR_API_KEY', client_secret: 'REPLACE_BY_YOUR_API_SECRET')
55
50
  ```
56
51
 
57
- Alternatively it can be initialized without any parameters if the environment
58
- variables `AMADEUS_CLIENT_ID` and `AMADEUS_CLIENT_SECRET` are present.
52
+ Alternatively, it can be initialized without any parameters if the environment variables `AMADEUS_CLIENT_ID` and `AMADEUS_CLIENT_SECRET` are present.
59
53
 
60
54
  ```rb
61
55
  amadeus = Amadeus::Client.new
62
56
  ```
63
57
 
64
- Your credentials can be found on the [Amadeus
65
- dashboard](https://developers.amadeus.com/my-apps). [Sign
66
- up](https://developers.amadeus.com/create-account) for an account today.
58
+ Your credentials can be found on the [Amadeus dashboard](https://developers.amadeus.com/my-apps).
67
59
 
68
- By default the environment for the SDK is the `:test` environment. To switch to
69
- a production (paid-for) environment please switch the hostname as follows:
60
+ By default, the environment for the SDK is the `:test` environment. To switch to a production (pay-as-you-go) environment please switch the hostname as follows:
70
61
 
71
62
  ```rb
72
63
  amadeus = Amadeus::Client.new(hostname: :production)
@@ -74,34 +65,26 @@ amadeus = Amadeus::Client.new(hostname: :production)
74
65
 
75
66
  ## Documentation
76
67
 
77
- Amadeus has a large set of APIs, and our documentation is here to get you
78
- started today. Head over to our
79
- [Reference](https://amadeus4dev.github.io/amadeus-ruby/) documentation for
80
- in-depth information about every SDK method, its arguments and return types.
68
+ Amadeus has a large set of APIs, and our documentation is here to get you started today. Head over to our [reference documentation](https://amadeus4dev.github.io/amadeus-ruby/) for in-depth information about every SDK method, its arguments and return types.
81
69
 
82
70
 
83
- * [Get Started](https://amadeus4dev.github.io/amadeus-ruby/) documentation
84
- * [Initialize the SDK](https://amadeus4dev.github.io/amadeus-ruby/)
71
+ * [Get Started](https://amadeus4dev.github.io/amadeus-ruby/)
85
72
  * [Find an Airport](https://amadeus4dev.github.io/amadeus-ruby/Amadeus/Namespaces/ReferenceData/Locations/Airports.html)
86
- * [Find a Flight](https://amadeus4dev.github.io/amadeus-ruby/Amadeus/Namespaces/Shopping/FlightOffers.html)
73
+ * [Find a Flight](https://amadeus4dev.github.io/amadeus-ruby/Amadeus/Namespaces/Shopping/FlightOffersSearch.html)
87
74
  * [Get Flight Inspiration](https://amadeus4dev.github.io/amadeus-ruby/Amadeus/Namespaces/Shopping/FlightDestinations.html)
88
75
 
89
76
  ## Making API calls
90
77
 
91
- This library conveniently maps every API path to a similar path.
92
-
93
- For example, `GET /v2/reference-data/urls/checkin-links?airlineCode=BA` would be:
78
+ This library conveniently maps every API path to a similar path. For example, `GET /v2/reference-data/urls/checkin-links?airlineCode=BA` would be:
94
79
 
95
80
  ```rb
96
81
  amadeus.reference_data.urls.checkin_links.get(airlineCode: 'BA')
97
82
  ```
98
83
 
99
- Similarly, to select a resource by ID, you can pass in the ID to the **singular** path.
100
-
101
- For example, `GET /v2/shopping/hotel-offers/XZY` would be:
84
+ Similarly, to select a resource by ID, you can pass in the ID to the **singular** path. For example, `GET /v2/shopping/hotel-offers/XZY` would be:
102
85
 
103
86
  ```rb
104
- amadeus.shopping.hotel_offer('D5BEE9D0D08B6678C2F5FAD910DC110BCDA187D21D4FCE68ED423426D0A246BB').get
87
+ amadeus.shopping.hotel_offer('XZY').get
105
88
  ```
106
89
 
107
90
  You can make any arbitrary API call as well directly with the `.get` method:
@@ -112,10 +95,7 @@ amadeus.get('/v2/reference-data/urls/checkin-links', airlineCode: 'BA')
112
95
 
113
96
  ## Response
114
97
 
115
- Every API call returns a `Amadeus::Response` object. If the API call contained
116
- a JSON response it will parse the JSON into the `.result` attribute. If this data
117
- also contains a `data` key, it will make that available as the `.data`
118
- attribute. The raw body of the response is always avaulable as the `.body` attribute.
98
+ Every API call returns a `Amadeus::Response` object. If the API call contained a JSON response, it will parse the JSON into `.result` attribute. If this data also contains a `data` key, that will be made available in `.data` attribute. The raw body of the response is always available in `.body` attribute.
119
99
 
120
100
  ```rb
121
101
  response = amadeus.reference_data.locations.get(
@@ -158,10 +138,7 @@ amadeus = Amadeus::Client.new(
158
138
  )
159
139
  ```
160
140
 
161
- Additionally, to enable more verbose logging, you can set the appropriate level
162
- on your own logger, though the easiest way would be to enable debugging via a
163
- parameter on initialization, or using the `AMADEUS_LOG_LEVEL` environment
164
- variable.
141
+ Additionally, to enable more verbose logging, you can set the appropriate level on your own logger. The easiest way would be to enable debugging via a parameter on initialization, or using the `AMADEUS_LOG_LEVEL` environment variable.
165
142
 
166
143
  ```rb
167
144
  require 'logger'
@@ -180,12 +157,15 @@ amadeus.shopping.flight_destinations.get(origin: 'MAD')
180
157
  # Flight Cheapest Date Search
181
158
  amadeus.shopping.flight_dates.get(origin: 'MAD', destination: 'MUC')
182
159
 
183
- # Flight Low-fare Search
184
- amadeus.shopping.flight_offers.get(origin: 'NYC', destination: 'MAD', departureDate: '2019-08-01')
160
+ # Flight Offers Search
161
+ amadeus.shopping.flight_offers_search.get(originLocationCode: 'NYC', destinationLocationCode: 'MAD', departureDate: '2021-05-01', adults: 1)
185
162
 
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)
163
+ # Flight Choice Prediction / Be careful, this example combines 2 API calls: 1. Flight Offers Search then Flight Choice Prediction
164
+ flight_offers = amadeus.shopping.flight_offers_search.get(originLocationCode: 'NYC', destinationLocationCode: 'MAD', departureDate: '2021-05-01', adults: 1, max: 1).body
165
+ amadeus.shopping.flight_offers_search.prediction.post(flight_offers)
188
166
 
167
+ # Flight Delay Prediction
168
+ amadeus.travel.predictions.flight_delay.get(originLocationCod: 'NCE', destinationLocationCod: 'IST', departureDat: '2021-05-01', departureTim: '18:20:00', arrivalDat: '2020-08-01', arrivalTim: '22:15:00', aircraftCod: '321', carrierCod: 'TK', flightNumber: '1816', duration: 'PT31H10M')
189
169
  # Flight Check-in Links
190
170
  amadeus.reference_data.urls.checkin_links.get(airlineCode: 'BA')
191
171
 
@@ -204,12 +184,6 @@ amadeus.reference_data.location('ALHR').get
204
184
  # Airport Nearest Relevant (for London)
205
185
  amadeus.reference_data.locations.airports.get(longitude: 0.1278, latitude: 51.5074)
206
186
 
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
187
  # Flight Most Booked Destinations
214
188
  amadeus.travel.analytics.air_traffic.booked.get(originCityCode: 'MAD', period: '2017-08')
215
189
 
@@ -223,7 +197,7 @@ amadeus.travel.analytics.air_traffic.busiest_period.get(
223
197
  direction: Amadeus::Direction::ARRIVING
224
198
  )
225
199
 
226
- # Hotel Search API
200
+ # Hotel Search
227
201
  # Get list of hotels by cityCode
228
202
  amadeus.shopping.hotel_offers.get(cityCode: 'MAD')
229
203
  # Get list of offers for a specific hotel
@@ -231,18 +205,44 @@ amadeus.shopping.hotel_offers_by_hotel.get(hotelId: 'IALONCHO')
231
205
  # Confirm the availability of a specific offer
232
206
  amadeus.shopping.hotel_offer('D5BEE9D0D08B6678C2F5FAD910DC110BCDA187D21D4FCE68ED423426D0A246BB').get
233
207
 
234
- # Point of Interest
208
+ # Hotel Booking
209
+ # The offerId comes from the hotel_offer above
210
+ amadeus.booking.hotel_bookings.post(offerId, guests, payments)
211
+
212
+ # Hotel Ratings
213
+ # What are the reviews for the Holiday INN Manhattan and the Hilton London Paddington
214
+ amadeus.e_reputation.hotel_sentiments.get(hotelIds: 'SJNYCAJA,TELONMFS')
215
+
216
+ # Points of Interest
235
217
  # What are the popular places in Barcelona (based a geo location and a radius)
236
218
  amadeus.reference_data.locations.points_of_interest.get(latitude: 41.397158, longitude: 2.160873)
237
219
  # What are the popular places in Barcelona? (based on a square)
238
220
  amadeus.reference_data.locations.points_of_interest.by_square.get(north: 41.397158, west: 2.160873, south: 41.394582, east: 2.177181)
221
+ # Returns a single Point of Interest from a given id
222
+ amadeus.reference_data.locations.point_of_interest('9CB40CB5D0').get()
223
+
224
+ # Safe Place
225
+ # How safe is Barcelona? (based a geo location and a radius)
226
+ amadeus.safety.safety_rated_locations.get(latitude: 41.397158, longitude: 2.160873)
227
+ # How safe is Barcelona? (based on a square)
228
+ amadeus.safety.safety_rated_locations.by_square.get(north: 41.397158, west: 2.160873, south: 41.394582, east: 2.177181)
229
+ # What is the safety information of a location based on it's Id?
230
+ amadeus.safety.safety_rated_location('Q930402753').get()
231
+
232
+ # Airport On-Time Performance
233
+ amadeus.airport.predictions.on_time.get(airportCode: 'JFK', date: '2020-08-01')
234
+
235
+ # Flight Price Analysis
236
+ amadeus.analytics.itinerary_price_metrics.get(originIataCode: 'AMS', destinationIataCode: 'CDG', departureDate: '2021-08-18')
237
+
238
+ # Trip Purpose Prediction
239
+ amadeus.travel.predictions.trip_purpose.get(originLocationCode: 'ATH', destinationLocationCode: 'MAD', departureDate: '2020-08-01', returnDate: '2020-08-12', searchDate: '2020-06-11')
239
240
  ```
240
241
  ## Development & Contributing
241
242
 
242
243
  Want to contribute? Read our [Contributors Guide](.github/CONTRIBUTING.md) for
243
244
  guidance on installing and running this code in a development environment.
244
245
 
245
-
246
246
  ## License
247
247
 
248
248
  This library is released under the [MIT License](LICENSE).
data/amadeus.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'amadeus/version'
@@ -24,19 +26,19 @@ Gem::Specification.new do |spec|
24
26
  spec.bindir = 'exe'
25
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
28
  spec.require_paths = ['lib']
27
- spec.required_ruby_version = '>= 2.2.0'
29
+ spec.required_ruby_version = '>= 2.4.0'
28
30
 
29
31
  spec.add_development_dependency 'awesome_print', '~> 1.8'
30
- spec.add_development_dependency 'bundler', '~> 2.0.1'
31
- spec.add_development_dependency 'guard', '~> 2.14'
32
+ spec.add_development_dependency 'bundler', '~> 2.2.14'
33
+ spec.add_development_dependency 'guard', '~> 2.16'
32
34
  spec.add_development_dependency 'guard-rake', '~> 1.0'
33
35
  spec.add_development_dependency 'guard-yard', '~> 2.2'
34
- spec.add_development_dependency 'rake', '~> 12.3'
36
+ spec.add_development_dependency 'rake', '~> 12.3.1'
35
37
  spec.add_development_dependency 'rb-readline', '~> 0.5.5'
36
- spec.add_development_dependency 'rspec', '~> 3.7'
37
- spec.add_development_dependency 'rubocop', '0.59'
38
- spec.add_development_dependency 'simplecov', '~> 0.15'
39
- spec.add_development_dependency 'vcr', '~> 4.0'
40
- spec.add_development_dependency 'webmock', '~> 3.3'
41
- spec.add_development_dependency 'yard', '~> 0.9.12'
38
+ spec.add_development_dependency 'rspec', '~> 3.9'
39
+ spec.add_development_dependency 'rubocop', '0.79'
40
+ spec.add_development_dependency 'simplecov', '~> 0.18'
41
+ spec.add_development_dependency 'vcr', '~> 5.1'
42
+ spec.add_development_dependency 'webmock', '~> 3.8'
43
+ spec.add_development_dependency 'yard', '~> 0.9.24'
42
44
  end
data/lib/amadeus.rb CHANGED
@@ -12,27 +12,42 @@ require 'amadeus/client'
12
12
  require 'amadeus/namespaces/travel'
13
13
  require 'amadeus/namespaces/shopping'
14
14
  require 'amadeus/namespaces/reference_data'
15
+ require 'amadeus/namespaces/e_reputation'
16
+ require 'amadeus/namespaces/booking'
17
+ require 'amadeus/namespaces/airport'
18
+ require 'amadeus/namespaces/safety'
19
+ require 'amadeus/namespaces/analytics'
20
+ require 'amadeus/namespaces/airport/predictions'
21
+ require 'amadeus/namespaces/airport/predictions/on_time'
22
+ require 'amadeus/namespaces/e_reputation/hotel_sentiments'
23
+ require 'amadeus/namespaces/booking/hotel_bookings'
15
24
  require 'amadeus/namespaces/reference_data/airlines'
16
25
  require 'amadeus/namespaces/reference_data/urls'
17
26
  require 'amadeus/namespaces/reference_data/urls/checkin_links'
18
27
  require 'amadeus/namespaces/reference_data/location'
19
28
  require 'amadeus/namespaces/reference_data/locations'
20
29
  require 'amadeus/namespaces/reference_data/locations/airports'
30
+ require 'amadeus/namespaces/reference_data/locations/point_of_interest'
21
31
  require 'amadeus/namespaces/reference_data/locations/points_of_interest'
22
32
  require 'amadeus/namespaces/reference_data/locations/points_of_interest/by_square'
33
+ require 'amadeus/namespaces/safety/safety_rated_location'
34
+ require 'amadeus/namespaces/safety/safety_rated_locations'
35
+ require 'amadeus/namespaces/safety/safety_rated_locations/by_square'
36
+ require 'amadeus/namespaces/analytics/itinerary_price_metrics'
23
37
  require 'amadeus/namespaces/shopping/flight_destinations'
24
- require 'amadeus/namespaces/shopping/flight_offers'
25
- require 'amadeus/namespaces/shopping/flight_offers/prediction'
38
+ require 'amadeus/namespaces/shopping/flight_offers_search'
39
+ require 'amadeus/namespaces/shopping/flight_offers_search/prediction'
26
40
  require 'amadeus/namespaces/shopping/flight_dates'
27
41
  require 'amadeus/namespaces/shopping/hotel_offers'
28
42
  require 'amadeus/namespaces/shopping/hotel_offer'
29
43
  require 'amadeus/namespaces/shopping/hotel_offers_by_hotel'
30
44
  require 'amadeus/namespaces/travel/analytics'
45
+ require 'amadeus/namespaces/travel/predictions'
46
+ require 'amadeus/namespaces/travel/predictions/trip_purpose'
47
+ require 'amadeus/namespaces/travel/predictions/flight_delay'
31
48
  require 'amadeus/namespaces/travel/analytics/air_traffic'
32
49
  require 'amadeus/namespaces/travel/analytics/air_traffic/traveled'
33
50
  require 'amadeus/namespaces/travel/analytics/air_traffic/booked'
34
- require 'amadeus/namespaces/travel/analytics/air_traffic/searched'
35
- require 'amadeus/namespaces/travel/analytics/air_traffic/searched_by_destination'
36
51
  require 'amadeus/namespaces/travel/analytics/air_traffic/busiest_period'
37
52
 
38
53
  # The namespace for the files used to make API
@@ -3,9 +3,7 @@
3
3
  module Amadeus
4
4
  # A list of directions, as used in Busiest Travel Period
5
5
  module Direction
6
- # Airport
7
- ARRIVING = 'ARRIVING'.freeze
8
- # City
9
- DEPARTING = 'DEPARTING'.freeze
6
+ ARRIVING = 'ARRIVING'
7
+ DEPARTING = 'DEPARTING'
10
8
  end
11
9
  end
@@ -64,11 +64,12 @@ module Amadeus
64
64
 
65
65
  # Determines the longer description, printed after the initial error
66
66
  def long_description
67
- return '' unless response && response.parsed
68
-
69
67
  message = ''
70
- message += error_description if response.result['error_description']
71
- message += errors_description if response.result['errors']
68
+ if response&.parsed
69
+ message += error_description if response.result['error_description']
70
+ message += errors_description if response.result['errors']
71
+ end
72
+
72
73
  message
73
74
  end
74
75
 
@@ -4,9 +4,9 @@ module Amadeus
4
4
  # A list of location types, as used in searching for locations
5
5
  module Location
6
6
  # Airport
7
- AIRPORT = 'AIRPORT'.freeze
7
+ AIRPORT = 'AIRPORT'
8
8
  # City
9
- CITY = 'CITY'.freeze
9
+ CITY = 'CITY'
10
10
  # Any
11
11
  ANY = [AIRPORT, CITY].join(',')
12
12
  end
@@ -25,7 +25,7 @@ module Amadeus
25
25
 
26
26
  # Used by .flatten_keys to add a sub key to a key
27
27
  def append_key(root_key, key)
28
- root_key.nil? ? :"#{key}" : :"#{root_key}[#{key.to_s}]"
28
+ root_key.nil? ? :"#{key}" : :"#{root_key}[#{key}]"
29
29
  end
30
30
  end
31
31
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amadeus
4
+ module Namespaces
5
+ # A namespaced client for the
6
+ # +/v1/airport+ endpoints
7
+ #
8
+ # Access via the +Amadeus::Client+ object
9
+ #
10
+ # amadeus = Amadeus::Client.new
11
+ # amadeus.airport
12
+ #
13
+ class Airport < Amadeus::Client::Decorator
14
+ # The namespace for the Ai APIs:
15
+ #
16
+ # @return [Amadeus::Namespaces::Airport::Predictions]
17
+ # @example
18
+ # amadeus.airport.predictions
19
+ #
20
+ def predictions
21
+ Amadeus::Namespaces::Airport::Predictions.new(client)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amadeus
4
+ module Namespaces
5
+ class Airport
6
+ # A namespaced client for the
7
+ # +/v1/airport/predictions+ endpoints
8
+ #
9
+ # Access via the +Amadeus::Client+ object
10
+ #
11
+ # amadeus = Amadeus::Client.new
12
+ # amadeus.airport.predictions
13
+ #
14
+ class Predictions < Amadeus::Client::Decorator
15
+ # The namespace for the Airport-OnTime-Prediction API:
16
+ #
17
+ # @return [Amadeus::Namespaces::Airport::Predictions::OnTime]
18
+ # @example
19
+ # amadeus.airport.predictions.on_time
20
+ #
21
+ def on_time
22
+ Amadeus::Namespaces::Airport::Predictions::OnTime.new(client)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end