amadeus 4.0.0 → 5.2.1
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 +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +43 -44
- data/amadeus.gemspec +12 -10
- 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/hash.rb +1 -1
- data/lib/amadeus/namespaces/airport/predictions/on_time.rb +32 -0
- data/lib/amadeus/namespaces/airport/predictions.rb +27 -0
- data/lib/amadeus/namespaces/airport.rb +25 -0
- data/lib/amadeus/namespaces/analytics/itinerary_price_metrics.rb +38 -0
- data/lib/amadeus/namespaces/analytics.rb +25 -0
- data/lib/amadeus/namespaces/core.rb +30 -0
- data/lib/amadeus/namespaces/reference_data/locations/point_of_interest.rb +44 -0
- data/lib/amadeus/namespaces/reference_data/locations.rb +13 -1
- data/lib/amadeus/namespaces/safety/safety_rated_location.rb +32 -0
- data/lib/amadeus/namespaces/safety/safety_rated_locations/by_square.rb +41 -0
- data/lib/amadeus/namespaces/safety/safety_rated_locations.rb +46 -0
- data/lib/amadeus/namespaces/safety.rb +34 -0
- data/lib/amadeus/namespaces/shopping/{flight_offers → flight_offers_search}/prediction.rb +7 -6
- data/lib/amadeus/namespaces/shopping/flight_offers_search.rb +61 -0
- data/lib/amadeus/namespaces/shopping.rb +4 -4
- 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/namespaces/travel/predictions.rb +37 -0
- data/lib/amadeus/namespaces/travel.rb +10 -1
- data/lib/amadeus/version.rb +1 -1
- data/lib/amadeus.rb +16 -3
- metadata +37 -25
- data/lib/amadeus/namespaces/shopping/flight_offers.rb +0 -47
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 33aae007eb2c940f808b5de0d0d006fd9a1f699cb9a607fb59d801290eb2f372
|
|
4
|
+
data.tar.gz: 87fdd06730f8dec43766019695da9d1f390ec2cd9f4f15e5c63cf0e493b2a28e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9044a656f932b284fa305a71670b2ab871458a0923c697d61600f521c09c3fe7a6e8e8c4ddb1b2880fe2896932e0eecfe2beea16d78c2983f2c45022956be132
|
|
7
|
+
data.tar.gz: 4661b308497f20c8a09c9c31e5003e3653120228ee3b977a45a7a66eff38df4f0194a078814f9cb7ad0efb365066d84e85921fa0c1acc80c7d845374d31a8cf7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
## 5.2.1 - 2021-11-30
|
|
3
|
+
Migrate to Github actions
|
|
4
|
+
|
|
5
|
+
## 5.2.0 - 2021-03-20
|
|
6
|
+
|
|
7
|
+
Add support for Flight Price Analysis. Thanks [@developius](https://github.com/developius) for the contribution.
|
|
8
|
+
## 5.1.0 - 2020-11-26
|
|
9
|
+
|
|
10
|
+
Add support for Safe Place API.
|
|
11
|
+
Add support for retrieve by id for Points Of Interest API
|
|
12
|
+
## 5.0.0 - 2020-05-14
|
|
13
|
+
Release of the Flight Offers Search API.
|
|
14
|
+
|
|
15
|
+
Add support for the Flight Choice Prediction v2.
|
|
16
|
+
|
|
17
|
+
Decommission of the Flight Low-fare Search and Flight Choice Prediction v1.
|
|
18
|
+
|
|
2
19
|
## 4.0.0 - 2020-02-12
|
|
3
20
|
Release of the [Hotel Booking API](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-booking)
|
|
4
21
|
|
data/README.md
CHANGED
|
@@ -5,16 +5,13 @@
|
|
|
5
5
|
[](https://codeclimate.com/github/amadeus4dev/amadeus-ruby/maintainability)
|
|
6
6
|
[](gem)
|
|
7
7
|
[][support]
|
|
8
|
+
[](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.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.
|
|
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/)
|
|
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,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
|
|
184
|
-
amadeus.shopping.
|
|
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
|
|
187
|
-
|
|
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
|
|
|
@@ -233,11 +213,30 @@ amadeus.booking.hotel_bookings.post(offerId, guests, payments)
|
|
|
233
213
|
# What are the reviews for the Holiday INN Manhattan and the Hilton London Paddington
|
|
234
214
|
amadeus.e_reputation.hotel_sentiments.get(hotelIds: 'SJNYCAJA,TELONMFS')
|
|
235
215
|
|
|
236
|
-
#
|
|
216
|
+
# Points of Interest
|
|
237
217
|
# What are the popular places in Barcelona (based a geo location and a radius)
|
|
238
218
|
amadeus.reference_data.locations.points_of_interest.get(latitude: 41.397158, longitude: 2.160873)
|
|
239
219
|
# What are the popular places in Barcelona? (based on a square)
|
|
240
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')
|
|
241
240
|
```
|
|
242
241
|
## Development & Contributing
|
|
243
242
|
|
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.
|
|
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.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.
|
|
37
|
-
spec.add_development_dependency 'rubocop', '0.
|
|
38
|
-
spec.add_development_dependency 'simplecov', '~> 0.
|
|
39
|
-
spec.add_development_dependency 'vcr', '~>
|
|
40
|
-
spec.add_development_dependency 'webmock', '~> 3.
|
|
41
|
-
spec.add_development_dependency 'yard', '~> 0.9.
|
|
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
|
|
@@ -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
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Amadeus
|
|
4
|
+
module Namespaces
|
|
5
|
+
class Airport
|
|
6
|
+
class Predictions
|
|
7
|
+
# A namespaced client for the
|
|
8
|
+
# +/v1/airport/predictions/on_time+ endpoints
|
|
9
|
+
#
|
|
10
|
+
# Access via the +Amadeus::Client+ object
|
|
11
|
+
#
|
|
12
|
+
# amadeus = Amadeus::Client.new
|
|
13
|
+
# amadeus.airport.predictions.on_time
|
|
14
|
+
#
|
|
15
|
+
class OnTime < Amadeus::Client::Decorator
|
|
16
|
+
# Returns a prediction on airport performance.
|
|
17
|
+
#
|
|
18
|
+
# @option params [String] :airportCode IATA code of the airport
|
|
19
|
+
# @option params [String] :date date of the prediction, in the future
|
|
20
|
+
# @return [Amadeus::Response] a parsed response
|
|
21
|
+
# @raise [Amadeus::Base] an exception if the call failed
|
|
22
|
+
# @example
|
|
23
|
+
# amadeus.airport.predictions.on_time.get(airportCode: 'JFK', date: '2020-09-01')
|
|
24
|
+
#
|
|
25
|
+
def get(params = {})
|
|
26
|
+
client.get('/v1/airport/predictions/on-time', params)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
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
|
|
@@ -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,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Amadeus
|
|
4
|
+
module Namespaces
|
|
5
|
+
class Analytics
|
|
6
|
+
# A namespaced client for the
|
|
7
|
+
# +/v1/analytics/itinerary-price-metrics+ endpoint
|
|
8
|
+
#
|
|
9
|
+
# Access via the +Amadeus::Client+ object
|
|
10
|
+
#
|
|
11
|
+
# amadeus = Amadeus::Client.new
|
|
12
|
+
# amadeus.analytics.itinerary_price_metrics
|
|
13
|
+
#
|
|
14
|
+
class ItineraryPriceMetrics < Amadeus::Client::Decorator
|
|
15
|
+
# Returns historical flight prices by date and route so you can see how current ticket
|
|
16
|
+
# prices stack up against the historical average
|
|
17
|
+
#
|
|
18
|
+
# @option params [String] :originIataCode IATA code of the airport to depart from
|
|
19
|
+
# @option params [String] :destinationIataCode IATA code of the airport to arrive at
|
|
20
|
+
# @option params [String] :departureDate date to depart on, formatted as YYYY-MM-DD
|
|
21
|
+
# @option params [String] :currencyCode the preferred currency (ISO 4217) - optional
|
|
22
|
+
# @option params [Boolean] :oneWay retrieve prices for one-way only - optional
|
|
23
|
+
# @return [Amadeus::Response] a parsed response
|
|
24
|
+
# @raise [Amadeus::Base] an exception if the call failed
|
|
25
|
+
# @example
|
|
26
|
+
# amadeus.analytics.itinerary_price_metrics.get(
|
|
27
|
+
# originIataCode: 'AMS',
|
|
28
|
+
# destinationIataCode: 'CDG',
|
|
29
|
+
# departureDate: '2021-06-18'
|
|
30
|
+
# )
|
|
31
|
+
#
|
|
32
|
+
def get(params = {})
|
|
33
|
+
client.get('/v1/analytics/itinerary-price-metrics', params)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
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/analytics+ endpoints
|
|
7
|
+
#
|
|
8
|
+
# Access via the +Amadeus::Client+ object
|
|
9
|
+
#
|
|
10
|
+
# amadeus = Amadeus::Client.new
|
|
11
|
+
# amadeus.analytics
|
|
12
|
+
#
|
|
13
|
+
class Analytics < Amadeus::Client::Decorator
|
|
14
|
+
# The namespace for the Analytics-ItineraryPriceMetrics API:
|
|
15
|
+
#
|
|
16
|
+
# @return [Amadeus::Namespaces::Analytics::ItineraryPriceMetrics]
|
|
17
|
+
# @example
|
|
18
|
+
# amadeus.analytics.itinerary_price_metrics
|
|
19
|
+
#
|
|
20
|
+
def itinerary_price_metrics
|
|
21
|
+
Amadeus::Namespaces::Analytics::ItineraryPriceMetrics.new(client)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -67,5 +67,35 @@ module Amadeus
|
|
|
67
67
|
def e_reputation
|
|
68
68
|
EReputation.new(self)
|
|
69
69
|
end
|
|
70
|
+
|
|
71
|
+
# The namespace for the Airport APIs:
|
|
72
|
+
#
|
|
73
|
+
# @return [Amadeus::Namespaces::Airport]
|
|
74
|
+
# @example Some of the further namespaces available
|
|
75
|
+
# amadeus.airport.predictions
|
|
76
|
+
#
|
|
77
|
+
def airport
|
|
78
|
+
Airport.new(self)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# The namespace for the Safety related APIs:
|
|
82
|
+
#
|
|
83
|
+
# @return [Amadeus::Namespaces::Safety]
|
|
84
|
+
# @example Some of the further namespaces available
|
|
85
|
+
# amadeus.safety.safety_rated_locations
|
|
86
|
+
#
|
|
87
|
+
def safety
|
|
88
|
+
Safety.new(self)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# The namespace for the Analytics related APIs:
|
|
92
|
+
#
|
|
93
|
+
# @return [Amadeus::Namespaces::Analytics]
|
|
94
|
+
# @example Some of the further namespaces available
|
|
95
|
+
# amadeus.analytics.itinerary_price_metrics
|
|
96
|
+
#
|
|
97
|
+
def analytics
|
|
98
|
+
Analytics.new(self)
|
|
99
|
+
end
|
|
70
100
|
end
|
|
71
101
|
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Amadeus
|
|
4
|
+
module Namespaces
|
|
5
|
+
class ReferenceData
|
|
6
|
+
class Locations
|
|
7
|
+
# A namespaced client for the
|
|
8
|
+
# +/v1/reference-data/locations/pois/:location_id+ endpoints
|
|
9
|
+
#
|
|
10
|
+
# Access via the +Amadeus::Client+ object
|
|
11
|
+
#
|
|
12
|
+
# amadeus = Amadeus::Client.new
|
|
13
|
+
# amadeus.reference_data.locations.point_of_interest('9CB40CB5D0')
|
|
14
|
+
#
|
|
15
|
+
class PointOfInterest < Amadeus::Client::Decorator
|
|
16
|
+
# the Location ID
|
|
17
|
+
attr_reader :poi_location_id
|
|
18
|
+
|
|
19
|
+
# Initialize this namespaced client with an
|
|
20
|
+
# {Amadeus::Client} instance and an optional Location ID
|
|
21
|
+
#
|
|
22
|
+
# @param [Amadeus::Client] client
|
|
23
|
+
# @param [Number] poi_location_id
|
|
24
|
+
#
|
|
25
|
+
def initialize(client, poi_location_id = nil)
|
|
26
|
+
super(client)
|
|
27
|
+
@poi_location_id = poi_location_id
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Returns details for a specific poi
|
|
31
|
+
#
|
|
32
|
+
# @return [Amadeus::Response] a parsed response
|
|
33
|
+
# @raise [Amadeus::Base] an exception if the call failed
|
|
34
|
+
# @example Retrieve poi information of '9CB40CB5D0'
|
|
35
|
+
# amadeus.reference_data.locations.point_of_interest('9CB40CB5D0').get
|
|
36
|
+
#
|
|
37
|
+
def get(params = {})
|
|
38
|
+
client.get("/v1/reference-data/locations/pois/#{@poi_location_id}", params)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -22,7 +22,7 @@ module Amadeus
|
|
|
22
22
|
Amadeus::Namespaces::ReferenceData::Locations::Airports.new(client)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
# The namespace for the
|
|
25
|
+
# The namespace for the Points Of Interest API:
|
|
26
26
|
#
|
|
27
27
|
# @return [Amadeus::Namespaces::ReferenceData::Locations::PointsOfInterest]
|
|
28
28
|
# @example
|
|
@@ -32,6 +32,18 @@ module Amadeus
|
|
|
32
32
|
Amadeus::Namespaces::ReferenceData::Locations::PointsOfInterest.new(client)
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
# The namespace for the Point Of Interest API:
|
|
36
|
+
#
|
|
37
|
+
# @return [Amadeus::Namespaces::ReferenceData::Locations::PointOfInterest]
|
|
38
|
+
# @example
|
|
39
|
+
# amadeus.reference_data.locations.point_of_interest
|
|
40
|
+
#
|
|
41
|
+
def point_of_interest(location_id)
|
|
42
|
+
Amadeus::Namespaces::ReferenceData::Locations::PointOfInterest.new(
|
|
43
|
+
client, location_id
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
35
47
|
# Returns a list of airports and cities matching a given keyword.
|
|
36
48
|
#
|
|
37
49
|
# @option params [String] :keyword keyword that should represent the
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Amadeus
|
|
4
|
+
module Namespaces
|
|
5
|
+
class Safety
|
|
6
|
+
# amadeus.safety.safety_rated_location('Q930400801').get()
|
|
7
|
+
class SafetyRatedLocation < Amadeus::Client::Decorator
|
|
8
|
+
attr_reader :safe_location_id
|
|
9
|
+
|
|
10
|
+
#
|
|
11
|
+
# @param [Amadeus::Client] client
|
|
12
|
+
# @param [Number] safe_location_id
|
|
13
|
+
#
|
|
14
|
+
def initialize(client, safe_location_id = nil)
|
|
15
|
+
super(client)
|
|
16
|
+
@safe_location_id = safe_location_id
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Returns details for a specific place
|
|
20
|
+
#
|
|
21
|
+
# @return [Amadeus::Response] a parsed response
|
|
22
|
+
# @raise [Amadeus::Base] an exception if the call failed
|
|
23
|
+
# @example Retrieve safety information of 'Q930402753'
|
|
24
|
+
# amadeus.safety.safety_rated_location('Q930402753').get
|
|
25
|
+
#
|
|
26
|
+
def get(params = {})
|
|
27
|
+
client.get("/v1/safety/safety-rated-locations/#{@safe_location_id}", params)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Amadeus
|
|
4
|
+
module Namespaces
|
|
5
|
+
class Safety
|
|
6
|
+
class SafetyRatedLocations
|
|
7
|
+
# A namespaced client for the
|
|
8
|
+
# +/v1/safety/safety_rated_locations/by-square+ endpoints
|
|
9
|
+
#
|
|
10
|
+
# Access via the +Amadeus::Client+ object
|
|
11
|
+
#
|
|
12
|
+
# amadeus = Amadeus::Client.new
|
|
13
|
+
# amadeus.safety.safety_rated_locations.by_square
|
|
14
|
+
#
|
|
15
|
+
class BySquare < Amadeus::Client::Decorator
|
|
16
|
+
# Returns a list of relevant safety information
|
|
17
|
+
# around a defined square (4 points).
|
|
18
|
+
#
|
|
19
|
+
# @option params [Double] :north Latitude north of bounding box - required
|
|
20
|
+
# @option params [Double] :west Longitude west of bounding box - required
|
|
21
|
+
# @option params [Double] :south Latitude south of bounding box - required
|
|
22
|
+
# @option params [Double] :east Longitude east of bounding box - required
|
|
23
|
+
# @return [Amadeus::Response] a parsed response
|
|
24
|
+
# @raise [Amadeus::Base] an exception if the call
|
|
25
|
+
# failed
|
|
26
|
+
# @example How safe is Barcelona?
|
|
27
|
+
# amadeus.safety.safety_rated_locations.by_square.get(
|
|
28
|
+
# north: 41.397158,
|
|
29
|
+
# west: 2.160873,
|
|
30
|
+
# south: 41.394582,
|
|
31
|
+
# east: 2.177181
|
|
32
|
+
# )
|
|
33
|
+
#
|
|
34
|
+
def get(params = {})
|
|
35
|
+
client.get('/v1/safety/safety-rated-locations/by-square', params)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|