amadeus 3.1.0 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +0 -7
- data/CHANGELOG.md +29 -1
- data/README.md +50 -49
- data/amadeus.gemspec +13 -10
- data/lib/amadeus.rb +17 -3
- data/lib/amadeus/client/direction.rb +2 -4
- data/lib/amadeus/client/errors.rb +5 -4
- data/lib/amadeus/client/location.rb +2 -2
- data/lib/amadeus/client/request.rb +7 -2
- data/lib/amadeus/client/request/hash.rb +1 -1
- data/lib/amadeus/namespaces/airport.rb +25 -0
- data/lib/amadeus/namespaces/airport/predictions.rb +27 -0
- data/lib/amadeus/namespaces/airport/predictions/on_time.rb +32 -0
- data/lib/amadeus/namespaces/booking.rb +25 -0
- data/lib/amadeus/namespaces/booking/hotel_bookings.rb +52 -0
- data/lib/amadeus/namespaces/core.rb +40 -0
- data/lib/amadeus/namespaces/e_reputation.rb +25 -0
- data/lib/amadeus/namespaces/e_reputation/hotel_sentiments.rb +31 -0
- data/lib/amadeus/namespaces/reference_data/locations.rb +13 -1
- data/lib/amadeus/namespaces/reference_data/locations/point_of_interest.rb +44 -0
- data/lib/amadeus/namespaces/safety.rb +34 -0
- data/lib/amadeus/namespaces/safety/safety_rated_location.rb +32 -0
- data/lib/amadeus/namespaces/safety/safety_rated_locations.rb +46 -0
- data/lib/amadeus/namespaces/safety/safety_rated_locations/by_square.rb +41 -0
- data/lib/amadeus/namespaces/shopping.rb +4 -4
- data/lib/amadeus/namespaces/shopping/flight_offers_search.rb +61 -0
- data/lib/amadeus/namespaces/shopping/flight_offers_search/prediction.rb +33 -0
- data/lib/amadeus/namespaces/travel.rb +10 -1
- data/lib/amadeus/namespaces/travel/analytics/air_traffic.rb +0 -23
- data/lib/amadeus/namespaces/travel/predictions.rb +37 -0
- data/lib/amadeus/namespaces/travel/predictions/flight_delay.rb +55 -0
- data/lib/amadeus/namespaces/travel/predictions/trip_purpose.rb +46 -0
- data/lib/amadeus/version.rb +1 -1
- metadata +53 -25
- data/lib/amadeus/namespaces/shopping/flight_offers.rb +0 -37
- data/lib/amadeus/namespaces/travel/analytics/air_traffic/searched.rb +0 -46
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d85348bf45e54be187cc91e512d1958c1a1162ae22d1bdeb3d7171ac78f4272
|
4
|
+
data.tar.gz: 06020e4f010c2512ac639e44fcdf36cfbd0492cf6cba07111a6ddb2167b9035d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f775996bc4b672820ac34c79296fca9a8b586a007c067af46335d9f3d9793cff5597c26845171cce8cf81dfc63a836f5a9951f9c18c6864a6d733270764ae10
|
7
|
+
data.tar.gz: 0bfa4b4bdc56a8e19b052e95587c96026d9eeda00211e932e2e40bf133c689059432cdb91430721bdbe732742a481f6b924decfe552259b8e1795efa3c0543be
|
data/.rubocop_todo.yml
CHANGED
@@ -12,13 +12,6 @@ Layout/SpaceAfterComma:
|
|
12
12
|
Exclude:
|
13
13
|
- 'amadeus.gemspec'
|
14
14
|
|
15
|
-
# Offense count: 1
|
16
|
-
# Cop supports --auto-correct.
|
17
|
-
# Configuration parameters: AllowInHeredoc.
|
18
|
-
Layout/TrailingWhitespace:
|
19
|
-
Exclude:
|
20
|
-
- 'spec/namespaces/travel/analytics/air_traffic/searched_by_destination.rb'
|
21
|
-
|
22
15
|
# Offense count: 1
|
23
16
|
# Configuration parameters: CountComments, ExcludedMethods.
|
24
17
|
# ExcludedMethods: refine
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,32 @@
|
|
1
1
|
# Changelog
|
2
|
+
## 5.1.0 - 2020-11-26
|
3
|
+
|
4
|
+
Add support for Safe Place API.
|
5
|
+
Add support for retrieve by id for Points Of Interest API
|
6
|
+
## 5.0.0 - 2020-05-14
|
7
|
+
Release of the Flight Offers Search API.
|
8
|
+
|
9
|
+
Add support for the Flight Choice Prediction v2.
|
10
|
+
|
11
|
+
Decommission of the Flight Low-fare Search and Flight Choice Prediction v1.
|
12
|
+
|
13
|
+
## 4.0.0 - 2020-02-12
|
14
|
+
Release of the [Hotel Booking API](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-booking)
|
15
|
+
|
16
|
+
> 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.
|
17
|
+
|
18
|
+
Decommissioning of the `Flight Most Searched Destination API`
|
19
|
+
|
20
|
+
## 3.3.0 - 2019-11-12
|
21
|
+
Release of the [Hotel Ratings](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-ratings)
|
22
|
+
|
23
|
+
> 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.
|
24
|
+
|
25
|
+
## 3.2.0 - 2019-05-08
|
26
|
+
Release of the [Flight Choice Prediction API](https://developers.amadeus.com/self-service/category/air/api-doc/flight-choice-prediction)
|
27
|
+
|
28
|
+
> 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.
|
29
|
+
|
2
30
|
## 3.1.0 - 2019-03-25
|
3
31
|
Release of the [Point of Interest API](https://developers.amadeus.com/self-service/category/210/api-doc/55)
|
4
32
|
|
@@ -47,7 +75,7 @@ Release of the [Point of Interest API](https://developers.amadeus.com/self-servi
|
|
47
75
|
|
48
76
|
## 1.1.0 - 2018-08-01
|
49
77
|
|
50
|
-
New version of the ruby gem to support our 3 new endpoints:
|
78
|
+
New version of the ruby gem to support our 3 new endpoints:
|
51
79
|
|
52
80
|
* [Flight Most Booked Destinations](https://developers.amadeus.com/self-service/category/203/api-doc/27)
|
53
81
|
|
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.
|
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.
|
14
|
+
This gem requires Ruby 2.4+. 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'
|
@@ -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/)
|
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/
|
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('
|
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,9 +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
|
184
|
-
amadeus.shopping.
|
160
|
+
# Flight Offers Search
|
161
|
+
amadeus.shopping.flight_offers_search.get(originLocationCode: 'NYC', destinationLocationCode: 'MAD', departureDate: '2020-10-01', adults: 1)
|
185
162
|
|
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: '2020-10-01', adults: 1, max: 1).body
|
165
|
+
amadeus.shopping.flight_offers_search.prediction.post(flight_offers)
|
166
|
+
|
167
|
+
# Flight Delay Prediction
|
168
|
+
amadeus.travel.predictions.flight_delay.get(originLocationCod: 'NCE', destinationLocationCod: 'IST', departureDat: '2020-08-01', departureTim: '18:20:00', arrivalDat: '2020-08-01', arrivalTim: '22:15:00', aircraftCod: '321', carrierCod: 'TK', flightNumber: '1816', duration: 'PT31H10M')
|
186
169
|
# Flight Check-in Links
|
187
170
|
amadeus.reference_data.urls.checkin_links.get(airlineCode: 'BA')
|
188
171
|
|
@@ -201,12 +184,6 @@ amadeus.reference_data.location('ALHR').get
|
|
201
184
|
# Airport Nearest Relevant (for London)
|
202
185
|
amadeus.reference_data.locations.airports.get(longitude: 0.1278, latitude: 51.5074)
|
203
186
|
|
204
|
-
# Flight Most Searched Destinations
|
205
|
-
# Get the most searched destinations from an origin
|
206
|
-
amadeus.travel.analytics.air_traffic.searched.get(originCityCode: 'MAD', searchPeriod: '2017-08', marketCountryCode: 'ES')
|
207
|
-
# How many people in Spain searched for a trip from Madrid to New-York in August 2017?
|
208
|
-
amadeus.travel.analytics.air_traffic.searched_by_destination.get(originCityCode: 'MAD', destinationCityCode: 'NYC', searchPeriod: '2017-08', marketCountryCode: 'ES')
|
209
|
-
|
210
187
|
# Flight Most Booked Destinations
|
211
188
|
amadeus.travel.analytics.air_traffic.booked.get(originCityCode: 'MAD', period: '2017-08')
|
212
189
|
|
@@ -220,7 +197,7 @@ amadeus.travel.analytics.air_traffic.busiest_period.get(
|
|
220
197
|
direction: Amadeus::Direction::ARRIVING
|
221
198
|
)
|
222
199
|
|
223
|
-
# Hotel Search
|
200
|
+
# Hotel Search
|
224
201
|
# Get list of hotels by cityCode
|
225
202
|
amadeus.shopping.hotel_offers.get(cityCode: 'MAD')
|
226
203
|
# Get list of offers for a specific hotel
|
@@ -228,18 +205,42 @@ amadeus.shopping.hotel_offers_by_hotel.get(hotelId: 'IALONCHO')
|
|
228
205
|
# Confirm the availability of a specific offer
|
229
206
|
amadeus.shopping.hotel_offer('D5BEE9D0D08B6678C2F5FAD910DC110BCDA187D21D4FCE68ED423426D0A246BB').get
|
230
207
|
|
231
|
-
#
|
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
|
232
217
|
# What are the popular places in Barcelona (based a geo location and a radius)
|
233
218
|
amadeus.reference_data.locations.points_of_interest.get(latitude: 41.397158, longitude: 2.160873)
|
234
219
|
# What are the popular places in Barcelona? (based on a square)
|
235
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
|
+
|
225
|
+
# Safe Place
|
226
|
+
# How safe is Barcelona? (based a geo location and a radius)
|
227
|
+
amadeus.safety.safety_rated_locations.get(latitude: 41.397158, longitude: 2.160873)
|
228
|
+
# How safe is Barcelona? (based on a square)
|
229
|
+
amadeus.safety.safety_rated_locations.by_square.get(north: 41.397158, west: 2.160873, south: 41.394582, east: 2.177181)
|
230
|
+
# What is the safety information of a location based on it's Id?
|
231
|
+
amadeus.safety.safety_rated_location('Q930402753').get()
|
232
|
+
|
233
|
+
# Airport On-Time Performance
|
234
|
+
amadeus.airport.predictions.on_time.get(airportCode: 'JFK', date: '2020-08-01')
|
235
|
+
|
236
|
+
# Trip Purpose Prediction
|
237
|
+
amadeus.travel.predictions.trip_purpose.get(originLocationCode: 'ATH', destinationLocationCode: 'MAD', departureDate: '2020-08-01', returnDate: '2020-08-12', searchDate: '2020-06-11')
|
236
238
|
```
|
237
239
|
## Development & Contributing
|
238
240
|
|
239
241
|
Want to contribute? Read our [Contributors Guide](.github/CONTRIBUTING.md) for
|
240
242
|
guidance on installing and running this code in a development environment.
|
241
243
|
|
242
|
-
|
243
244
|
## License
|
244
245
|
|
245
246
|
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,18 +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.
|
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.
|
31
|
-
spec.add_development_dependency 'guard', '~> 2.
|
32
|
+
spec.add_development_dependency 'bundler', '~> 2.1.2'
|
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'
|
35
|
-
spec.add_development_dependency '
|
36
|
-
spec.add_development_dependency '
|
37
|
-
spec.add_development_dependency '
|
38
|
-
spec.add_development_dependency '
|
39
|
-
spec.add_development_dependency '
|
40
|
-
spec.add_development_dependency '
|
36
|
+
spec.add_development_dependency 'rake', '~> 12.3.1'
|
37
|
+
spec.add_development_dependency 'rb-readline', '~> 0.5.5'
|
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'
|
41
44
|
end
|
data/lib/amadeus.rb
CHANGED
@@ -12,26 +12,40 @@ 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/airport/predictions'
|
20
|
+
require 'amadeus/namespaces/airport/predictions/on_time'
|
21
|
+
require 'amadeus/namespaces/e_reputation/hotel_sentiments'
|
22
|
+
require 'amadeus/namespaces/booking/hotel_bookings'
|
15
23
|
require 'amadeus/namespaces/reference_data/airlines'
|
16
24
|
require 'amadeus/namespaces/reference_data/urls'
|
17
25
|
require 'amadeus/namespaces/reference_data/urls/checkin_links'
|
18
26
|
require 'amadeus/namespaces/reference_data/location'
|
19
27
|
require 'amadeus/namespaces/reference_data/locations'
|
20
28
|
require 'amadeus/namespaces/reference_data/locations/airports'
|
29
|
+
require 'amadeus/namespaces/reference_data/locations/point_of_interest'
|
21
30
|
require 'amadeus/namespaces/reference_data/locations/points_of_interest'
|
22
31
|
require 'amadeus/namespaces/reference_data/locations/points_of_interest/by_square'
|
32
|
+
require 'amadeus/namespaces/safety/safety_rated_location'
|
33
|
+
require 'amadeus/namespaces/safety/safety_rated_locations'
|
34
|
+
require 'amadeus/namespaces/safety/safety_rated_locations/by_square'
|
23
35
|
require 'amadeus/namespaces/shopping/flight_destinations'
|
24
|
-
require 'amadeus/namespaces/shopping/
|
36
|
+
require 'amadeus/namespaces/shopping/flight_offers_search'
|
37
|
+
require 'amadeus/namespaces/shopping/flight_offers_search/prediction'
|
25
38
|
require 'amadeus/namespaces/shopping/flight_dates'
|
26
39
|
require 'amadeus/namespaces/shopping/hotel_offers'
|
27
40
|
require 'amadeus/namespaces/shopping/hotel_offer'
|
28
41
|
require 'amadeus/namespaces/shopping/hotel_offers_by_hotel'
|
29
42
|
require 'amadeus/namespaces/travel/analytics'
|
43
|
+
require 'amadeus/namespaces/travel/predictions'
|
44
|
+
require 'amadeus/namespaces/travel/predictions/trip_purpose'
|
45
|
+
require 'amadeus/namespaces/travel/predictions/flight_delay'
|
30
46
|
require 'amadeus/namespaces/travel/analytics/air_traffic'
|
31
47
|
require 'amadeus/namespaces/travel/analytics/air_traffic/traveled'
|
32
48
|
require 'amadeus/namespaces/travel/analytics/air_traffic/booked'
|
33
|
-
require 'amadeus/namespaces/travel/analytics/air_traffic/searched'
|
34
|
-
require 'amadeus/namespaces/travel/analytics/air_traffic/searched_by_destination'
|
35
49
|
require 'amadeus/namespaces/travel/analytics/air_traffic/busiest_period'
|
36
50
|
|
37
51
|
# The namespace for the files used to make API
|
@@ -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
|
-
|
71
|
-
|
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'
|
7
|
+
AIRPORT = 'AIRPORT'
|
8
8
|
# City
|
9
|
-
CITY = 'CITY'
|
9
|
+
CITY = 'CITY'
|
10
10
|
# Any
|
11
11
|
ANY = [AIRPORT, CITY].join(',')
|
12
12
|
end
|
@@ -111,8 +111,13 @@ module Amadeus
|
|
111
111
|
def add_post_data(request)
|
112
112
|
return unless @verb == :POST
|
113
113
|
|
114
|
-
@
|
115
|
-
|
114
|
+
if @bearer_token.nil?
|
115
|
+
@headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
116
|
+
request.form_data = @params
|
117
|
+
else
|
118
|
+
@headers['Content-Type'] = 'application/vnd.amadeus+json'
|
119
|
+
request.body = @params
|
120
|
+
end
|
116
121
|
end
|
117
122
|
|
118
123
|
def add_bearer_token(_request)
|
@@ -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
|