amadeus 4.0.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +13 -4
- data/amadeus.gemspec +11 -9
- data/lib/amadeus.rb +9 -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/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/core.rb +10 -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 → flight_offers_search}/prediction.rb +7 -6
- data/lib/amadeus/namespaces/travel.rb +10 -1
- 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 +27 -21
- 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: daa2f88d0dd02caa16558d86e65df76459220e0e9cdc9f12c4f3345e29bb4be2
|
4
|
+
data.tar.gz: 6a8c25052107c18810dd9b7d0a22bc2fc489828e88b24aab0f842937794dd43b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce3a0e248e96a067e56172a0fda8a6b614c3dde2e61905130e5ccd86658e96f1e28786b686171d5447bcc1e46e137fb87e6c93c11ec74c132f31233de5471def
|
7
|
+
data.tar.gz: 72dd837abaee061718587382bd0a81cdf67fd1f6545be39c45d76ed8803f0cffa55bfcba93fe4f4462ad9872d21b1f9d2c1609eeca3d7f3e6529424e0b16c73d
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,11 @@
|
|
1
1
|
# Changelog
|
2
|
+
## 5.0.0 - 2020-05-14
|
3
|
+
Release of the Flight Offers Search API.
|
4
|
+
|
5
|
+
Add support for the Flight Choice Prediction v2.
|
6
|
+
|
7
|
+
Decommission of the Flight Low-fare Search and Flight Choice Prediction v1.
|
8
|
+
|
2
9
|
## 4.0.0 - 2020-02-12
|
3
10
|
Release of the [Hotel Booking API](https://developers.amadeus.com/self-service/category/hotel/api-doc/hotel-booking)
|
4
11
|
|
data/README.md
CHANGED
@@ -180,12 +180,15 @@ amadeus.shopping.flight_destinations.get(origin: 'MAD')
|
|
180
180
|
# Flight Cheapest Date Search
|
181
181
|
amadeus.shopping.flight_dates.get(origin: 'MAD', destination: 'MUC')
|
182
182
|
|
183
|
-
# Flight
|
184
|
-
amadeus.shopping.
|
183
|
+
# Flight Offers Search
|
184
|
+
amadeus.shopping.flight_offers_search.get(originLocationCode: 'NYC', destinationLocationCode: 'MAD', departureDate: '2020-10-01', adults: 1)
|
185
185
|
|
186
|
-
# Flight Choice Prediction / Be careful, this example combines 2 API calls: 1. Flight
|
187
|
-
|
186
|
+
# Flight Choice Prediction / Be careful, this example combines 2 API calls: 1. Flight Offers Search then Flight Choice Prediction
|
187
|
+
flight_offers = amadeus.shopping.flight_offers_search.get(originLocationCode: 'NYC', destinationLocationCode: 'MAD', departureDate: '2020-10-01', adults: 1, max: 1).body
|
188
|
+
amadeus.shopping.flight_offers_search.prediction.post(flight_offers)
|
188
189
|
|
190
|
+
# Flight Delay Prediction
|
191
|
+
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')
|
189
192
|
# Flight Check-in Links
|
190
193
|
amadeus.reference_data.urls.checkin_links.get(airlineCode: 'BA')
|
191
194
|
|
@@ -238,6 +241,12 @@ amadeus.e_reputation.hotel_sentiments.get(hotelIds: 'SJNYCAJA,TELONMFS')
|
|
238
241
|
amadeus.reference_data.locations.points_of_interest.get(latitude: 41.397158, longitude: 2.160873)
|
239
242
|
# What are the popular places in Barcelona? (based on a square)
|
240
243
|
amadeus.reference_data.locations.points_of_interest.by_square.get(north: 41.397158, west: 2.160873, south: 41.394582, east: 2.177181)
|
244
|
+
|
245
|
+
# Airport On-Time Performance
|
246
|
+
amadeus.airport.predictions.on_time.get(airportCode: 'JFK', date: '2020-08-01')
|
247
|
+
|
248
|
+
# Trip Purpose Prediction
|
249
|
+
amadeus.travel.predictions.trip_purpose.get(originLocationCode: 'ATH', destinationLocationCode: 'MAD', departureDate: '2020-08-01', returnDate: '2020-08-12', searchDate: '2020-06-11')
|
241
250
|
```
|
242
251
|
## Development & Contributing
|
243
252
|
|
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
32
|
spec.add_development_dependency 'bundler', '~> 2.1.2'
|
31
|
-
spec.add_development_dependency 'guard', '~> 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'
|
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
|
data/lib/amadeus.rb
CHANGED
@@ -14,7 +14,11 @@ require 'amadeus/namespaces/shopping'
|
|
14
14
|
require 'amadeus/namespaces/reference_data'
|
15
15
|
require 'amadeus/namespaces/e_reputation'
|
16
16
|
require 'amadeus/namespaces/booking'
|
17
|
+
require 'amadeus/namespaces/airport'
|
18
|
+
require 'amadeus/namespaces/airport/predictions'
|
19
|
+
require 'amadeus/namespaces/airport/predictions/on_time'
|
17
20
|
require 'amadeus/namespaces/e_reputation/hotel_sentiments'
|
21
|
+
require 'amadeus/namespaces/booking/hotel_bookings'
|
18
22
|
require 'amadeus/namespaces/reference_data/airlines'
|
19
23
|
require 'amadeus/namespaces/reference_data/urls'
|
20
24
|
require 'amadeus/namespaces/reference_data/urls/checkin_links'
|
@@ -24,18 +28,20 @@ require 'amadeus/namespaces/reference_data/locations/airports'
|
|
24
28
|
require 'amadeus/namespaces/reference_data/locations/points_of_interest'
|
25
29
|
require 'amadeus/namespaces/reference_data/locations/points_of_interest/by_square'
|
26
30
|
require 'amadeus/namespaces/shopping/flight_destinations'
|
27
|
-
require 'amadeus/namespaces/shopping/
|
28
|
-
require 'amadeus/namespaces/shopping/
|
31
|
+
require 'amadeus/namespaces/shopping/flight_offers_search'
|
32
|
+
require 'amadeus/namespaces/shopping/flight_offers_search/prediction'
|
29
33
|
require 'amadeus/namespaces/shopping/flight_dates'
|
30
34
|
require 'amadeus/namespaces/shopping/hotel_offers'
|
31
35
|
require 'amadeus/namespaces/shopping/hotel_offer'
|
32
36
|
require 'amadeus/namespaces/shopping/hotel_offers_by_hotel'
|
33
37
|
require 'amadeus/namespaces/travel/analytics'
|
38
|
+
require 'amadeus/namespaces/travel/predictions'
|
39
|
+
require 'amadeus/namespaces/travel/predictions/trip_purpose'
|
40
|
+
require 'amadeus/namespaces/travel/predictions/flight_delay'
|
34
41
|
require 'amadeus/namespaces/travel/analytics/air_traffic'
|
35
42
|
require 'amadeus/namespaces/travel/analytics/air_traffic/traveled'
|
36
43
|
require 'amadeus/namespaces/travel/analytics/air_traffic/booked'
|
37
44
|
require 'amadeus/namespaces/travel/analytics/air_traffic/busiest_period'
|
38
|
-
require 'amadeus/namespaces/booking/hotel_bookings'
|
39
45
|
|
40
46
|
# The namespace for the files used to make API
|
41
47
|
# calls to the Amadeus travel APIs
|
@@ -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,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
|
@@ -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
|
@@ -67,5 +67,15 @@ 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
|
70
80
|
end
|
71
81
|
end
|
@@ -23,12 +23,12 @@ module Amadeus
|
|
23
23
|
|
24
24
|
# The namespace for the FlightOffers API:
|
25
25
|
#
|
26
|
-
# @return [Amadeus::Namespaces::Shopping::
|
26
|
+
# @return [Amadeus::Namespaces::Shopping::FlightOffersSearch]
|
27
27
|
# @example
|
28
|
-
# amadeus.shopping.
|
28
|
+
# amadeus.shopping.flight_offers_search
|
29
29
|
#
|
30
|
-
def
|
31
|
-
Amadeus::Namespaces::Shopping::
|
30
|
+
def flight_offers_search
|
31
|
+
Amadeus::Namespaces::Shopping::FlightOffersSearch.new(client)
|
32
32
|
end
|
33
33
|
|
34
34
|
# The namespace for the FlightDates API:
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Amadeus
|
4
|
+
module Namespaces
|
5
|
+
class Shopping
|
6
|
+
# A namespaced client for the
|
7
|
+
# +/v2/shopping/flight-offers+ endpoints
|
8
|
+
#
|
9
|
+
# Access via the +Amadeus::Client+ object
|
10
|
+
#
|
11
|
+
# amadeus = Amadeus::Client.new
|
12
|
+
# amadeus.shopping.flight_offers_search
|
13
|
+
#
|
14
|
+
class FlightOffersSearch < Amadeus::Client::Decorator
|
15
|
+
# The namespace for the Prediction API:
|
16
|
+
#
|
17
|
+
# @return [Amadeus::Namespaces::Shopping::FlightOffersSearch::Prediction]
|
18
|
+
# @example
|
19
|
+
# amadeus.shopping.flight_offers_search.prediction
|
20
|
+
#
|
21
|
+
def prediction
|
22
|
+
Amadeus::Namespaces::Shopping::FlightOffersSearch::Prediction.new(client)
|
23
|
+
end
|
24
|
+
# Find the cheapest bookable flights.
|
25
|
+
#
|
26
|
+
# @option params [String] :origin City/Airport IATA code from which the
|
27
|
+
# flight will depart. BOS, for example.
|
28
|
+
# @option params [String] :destination City/Airport IATA code to which
|
29
|
+
# the traveler is going. PAR, for example
|
30
|
+
# @return [Amadeus::Response] a parsed response
|
31
|
+
# @raise [Amadeus::Base] an exception if the call failed
|
32
|
+
# @example Find the cheapest flight offers from New-York to Madrid,
|
33
|
+
# for the first of October 2020
|
34
|
+
# amadeus.shopping.flight_offers_search.get(
|
35
|
+
# originLocationCode: 'NYC',
|
36
|
+
# destinationLocationCode: 'MAD',
|
37
|
+
# departureDate: '2020-10-01',
|
38
|
+
# adults: 1
|
39
|
+
# )
|
40
|
+
#
|
41
|
+
|
42
|
+
def get(params = {})
|
43
|
+
client.get('/v2/shopping/flight-offers', params)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Find the cheapest bookable flights.
|
47
|
+
#
|
48
|
+
# @option body [JSON] :body flight search parameters
|
49
|
+
# @return [Amadeus::Response] a parsed response
|
50
|
+
# @raise [Amadeus::Base] an exception if the call
|
51
|
+
# failed
|
52
|
+
# @example
|
53
|
+
# amadeus.shopping.flight_offers_search.post(body)
|
54
|
+
#
|
55
|
+
def post(params = {})
|
56
|
+
client.post('/v2/shopping/flight-offers', params)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -3,27 +3,28 @@
|
|
3
3
|
module Amadeus
|
4
4
|
module Namespaces
|
5
5
|
class Shopping
|
6
|
-
class
|
6
|
+
class FlightOffersSearch
|
7
7
|
# A namespaced client for the
|
8
|
-
# +/
|
8
|
+
# +/v2/shopping/flight-offers/prediction+ endpoints
|
9
9
|
#
|
10
10
|
# Access via the +Amadeus::Client+ object
|
11
11
|
#
|
12
12
|
# amadeus = Amadeus::Client.new
|
13
|
-
# amadeus.shopping.
|
13
|
+
# amadeus.shopping.flight_offers_search.prediction
|
14
14
|
#
|
15
15
|
class Prediction < Amadeus::Client::Decorator
|
16
16
|
# Returns a list of flight offers including a choice prediction for each itineary.
|
17
17
|
#
|
18
|
-
# @option body [JSON] :body JSON response of the Flight
|
18
|
+
# @option body [JSON] :body JSON response of the Flight Offers Search API
|
19
19
|
# @return [Amadeus::Response] a parsed response
|
20
20
|
# @raise [Amadeus::Base] an exception if the call
|
21
21
|
# failed
|
22
22
|
# @example
|
23
|
-
# amadeus.shopping.
|
23
|
+
# amadeus.shopping.flight_offers_search.prediction.post(
|
24
|
+
# flight_offers_search_response.body)
|
24
25
|
#
|
25
26
|
def post(params = {})
|
26
|
-
client.post('/
|
27
|
+
client.post('/v2/shopping/flight-offers/prediction', params)
|
27
28
|
end
|
28
29
|
end
|
29
30
|
end
|
@@ -16,11 +16,20 @@ module Amadeus
|
|
16
16
|
# @return [Amadeus::Namespaces::Travel::Analytics]
|
17
17
|
# @example
|
18
18
|
# amadeus.travel.analytics.air_traffic
|
19
|
-
# amadeus.travel.analytics.fare_searches
|
20
19
|
#
|
21
20
|
def analytics
|
22
21
|
Amadeus::Namespaces::Travel::Analytics.new(client)
|
23
22
|
end
|
23
|
+
|
24
|
+
# The namespace for the travel Predictions APIs:
|
25
|
+
#
|
26
|
+
# @return [Amadeus::Namespaces::Travel::Predictions]
|
27
|
+
# @example
|
28
|
+
# amadeus.travel.predictions.trip_purpose
|
29
|
+
#
|
30
|
+
def predictions
|
31
|
+
Amadeus::Namespaces::Travel::Predictions.new(client)
|
32
|
+
end
|
24
33
|
end
|
25
34
|
end
|
26
35
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Amadeus
|
4
|
+
module Namespaces
|
5
|
+
class Travel
|
6
|
+
# A namespaced client for the
|
7
|
+
# +/v1/travel/predictions+ endpoints
|
8
|
+
#
|
9
|
+
# Access via the +Amadeus::Client+ object
|
10
|
+
#
|
11
|
+
# amadeus = Amadeus::Client.new
|
12
|
+
# amadeus.travel.predictions
|
13
|
+
#
|
14
|
+
class Predictions < Amadeus::Client::Decorator
|
15
|
+
# The namespace for the travel Predictions APIs:
|
16
|
+
#
|
17
|
+
# @return [Amadeus::Namespaces::Travel::Predictions]
|
18
|
+
# @example
|
19
|
+
# amadeus.travel.predictions.trip_purpose
|
20
|
+
#
|
21
|
+
def trip_purpose
|
22
|
+
Amadeus::Namespaces::Travel::Predictions::TripPurpose.new(client)
|
23
|
+
end
|
24
|
+
|
25
|
+
# The namespace for the travel Predictions APIs:
|
26
|
+
#
|
27
|
+
# @return [Amadeus::Namespaces::Travel::Predictions]
|
28
|
+
# @example
|
29
|
+
# amadeus.travel.predictions.flight_delay
|
30
|
+
#
|
31
|
+
def flight_delay
|
32
|
+
Amadeus::Namespaces::Travel::Predictions::FlightDelay.new(client)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Amadeus
|
4
|
+
module Namespaces
|
5
|
+
class Travel
|
6
|
+
class Predictions
|
7
|
+
# A namespaced client for the
|
8
|
+
# +/v1/travel/predictions/flight_delay+ endpoints
|
9
|
+
#
|
10
|
+
# Access via the +Amadeus::Client+ object
|
11
|
+
#
|
12
|
+
# amadeus = Amadeus::Client.new
|
13
|
+
# amadeus.travel.predictions.flight_delay
|
14
|
+
#
|
15
|
+
class FlightDelay < Amadeus::Client::Decorator
|
16
|
+
# Forecast the chances for a flight to be delayed
|
17
|
+
# @option params [String] :originLocationCode the Airport IATA code from which
|
18
|
+
# the flight will depart. ``"NYC"``, for example for New York - required
|
19
|
+
# @option params [String] :destinationLocationCode the Airport IATA code to which
|
20
|
+
# the flight is going. ``"MAD"``, for example for Madrid - required
|
21
|
+
# @option params [String] :departureDate the date on which to fly out,
|
22
|
+
# in `YYYY-MM-DD` format - required
|
23
|
+
# @option params [String] :departureTime local time on which to fly out,
|
24
|
+
# in `HH:MM:SS` format - required
|
25
|
+
# @option params [String] :arrivalDate date on which the flight returns to the origin,
|
26
|
+
# in `YYYY-MM-DD` format - required
|
27
|
+
# @option params [String] :arrivalTime local time on which to fly out,
|
28
|
+
# in `HH:MM:SS` format - required
|
29
|
+
# @option params [String] :aircraftCode IATA aircraft code - required
|
30
|
+
# @option params [String] :carrierCode airline / carrier code - required
|
31
|
+
# @option params [String] :flightNumber flight number - required
|
32
|
+
# @option params [String] :duration flight duration,
|
33
|
+
# in `PnYnMnDTnHnMnS` format e.g. PT2H10M - required
|
34
|
+
# @return [Amadeus::Response] a parsed response
|
35
|
+
# @raise [Amadeus::Base] an exception if the call failed
|
36
|
+
# @example
|
37
|
+
# amadeus.travel.predictions.flight_delay.get(originLocationCode: 'NCE',
|
38
|
+
# destinationLocationCode: 'IST',
|
39
|
+
# departureDate: '2020-08-01',
|
40
|
+
# departureTime: '18:20:00',
|
41
|
+
# arrivalDate: '2020-08-01',
|
42
|
+
# arrivalTime: '22:15:00',
|
43
|
+
# aircraftCode: '321',
|
44
|
+
# carrierCode: 'TK',
|
45
|
+
# flightNumber: '1816',
|
46
|
+
# duration: 'PT31H10M')
|
47
|
+
#
|
48
|
+
def get(params = {})
|
49
|
+
client.get('/v1/travel/predictions/flight-delay', params)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Amadeus
|
4
|
+
module Namespaces
|
5
|
+
class Travel
|
6
|
+
class Predictions
|
7
|
+
# A namespaced client for the
|
8
|
+
# +/v1/travel/predictions/trip_purpose+ endpoints
|
9
|
+
#
|
10
|
+
# Access via the +Amadeus::Client+ object
|
11
|
+
#
|
12
|
+
# amadeus = Amadeus::Client.new
|
13
|
+
# amadeus.travel.predictions.trip_purpose
|
14
|
+
#
|
15
|
+
class TripPurpose < Amadeus::Client::Decorator
|
16
|
+
# Predicts traveler purpose, Business or Leisure,
|
17
|
+
# with the probability in the context of search & shopping
|
18
|
+
# @option params [String] :originLocationCode the City/Airport IATA code from which
|
19
|
+
# the flight will depart. ``"NYC"``, for example for New York - required
|
20
|
+
# @option params [String] :destinationLocationCode the City/Airport IATA code to which
|
21
|
+
# the flight is going. ``"MAD"``, for example for Madrid - required
|
22
|
+
# @option params [String] :departureDate the date on which to fly out,
|
23
|
+
# in `YYYY-MM-DD` format - required
|
24
|
+
# @option params [String] :returnDate date on which the flight returns to the origin,
|
25
|
+
# in `YYYY-MM-DD` format - required
|
26
|
+
# @option params [String] :searchDate date on which the traveler performs the search,
|
27
|
+
# in `YYYY-MM-DD` format.
|
28
|
+
# If it is not specified the current date will be used - optional
|
29
|
+
# @return [Amadeus::Response] a parsed response
|
30
|
+
# @raise [Amadeus::Base] an exception if the call failed
|
31
|
+
# @example what is the name of airline code 'U2'
|
32
|
+
# amadeus.travel.predictions.trip_purpose.get(
|
33
|
+
# originLocationCode: 'NYC',
|
34
|
+
# destinationLocationCode: 'MAD',
|
35
|
+
# departureDate: '2020-08-01',
|
36
|
+
# returnDate: '2020-08-12',
|
37
|
+
# searchDate: '2020-06-11')
|
38
|
+
#
|
39
|
+
def get(params = {})
|
40
|
+
client.get('/v1/travel/predictions/trip-purpose', params)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/amadeus/version.rb
CHANGED
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:
|
4
|
+
version: 5.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: 2020-
|
13
|
+
date: 2020-05-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: awesome_print
|
@@ -46,14 +46,14 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '2.
|
49
|
+
version: '2.16'
|
50
50
|
type: :development
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '2.
|
56
|
+
version: '2.16'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: guard-rake
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,14 +88,14 @@ dependencies:
|
|
88
88
|
requirements:
|
89
89
|
- - "~>"
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
91
|
+
version: 12.3.1
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - "~>"
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
98
|
+
version: 12.3.1
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: rb-readline
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,84 +116,84 @@ dependencies:
|
|
116
116
|
requirements:
|
117
117
|
- - "~>"
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: '3.
|
119
|
+
version: '3.9'
|
120
120
|
type: :development
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
124
|
- - "~>"
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: '3.
|
126
|
+
version: '3.9'
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: rubocop
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
131
|
- - '='
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: '0.
|
133
|
+
version: '0.79'
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
138
|
- - '='
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version: '0.
|
140
|
+
version: '0.79'
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
142
|
name: simplecov
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
145
|
- - "~>"
|
146
146
|
- !ruby/object:Gem::Version
|
147
|
-
version: '0.
|
147
|
+
version: '0.18'
|
148
148
|
type: :development
|
149
149
|
prerelease: false
|
150
150
|
version_requirements: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
152
|
- - "~>"
|
153
153
|
- !ruby/object:Gem::Version
|
154
|
-
version: '0.
|
154
|
+
version: '0.18'
|
155
155
|
- !ruby/object:Gem::Dependency
|
156
156
|
name: vcr
|
157
157
|
requirement: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
159
|
- - "~>"
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version: '
|
161
|
+
version: '5.1'
|
162
162
|
type: :development
|
163
163
|
prerelease: false
|
164
164
|
version_requirements: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
166
|
- - "~>"
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
version: '
|
168
|
+
version: '5.1'
|
169
169
|
- !ruby/object:Gem::Dependency
|
170
170
|
name: webmock
|
171
171
|
requirement: !ruby/object:Gem::Requirement
|
172
172
|
requirements:
|
173
173
|
- - "~>"
|
174
174
|
- !ruby/object:Gem::Version
|
175
|
-
version: '3.
|
175
|
+
version: '3.8'
|
176
176
|
type: :development
|
177
177
|
prerelease: false
|
178
178
|
version_requirements: !ruby/object:Gem::Requirement
|
179
179
|
requirements:
|
180
180
|
- - "~>"
|
181
181
|
- !ruby/object:Gem::Version
|
182
|
-
version: '3.
|
182
|
+
version: '3.8'
|
183
183
|
- !ruby/object:Gem::Dependency
|
184
184
|
name: yard
|
185
185
|
requirement: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
187
|
- - "~>"
|
188
188
|
- !ruby/object:Gem::Version
|
189
|
-
version: 0.9.
|
189
|
+
version: 0.9.24
|
190
190
|
type: :development
|
191
191
|
prerelease: false
|
192
192
|
version_requirements: !ruby/object:Gem::Requirement
|
193
193
|
requirements:
|
194
194
|
- - "~>"
|
195
195
|
- !ruby/object:Gem::Version
|
196
|
-
version: 0.9.
|
196
|
+
version: 0.9.24
|
197
197
|
description: |2
|
198
198
|
Ruby library for the Amadeus travel APIs, providing hotel, flight, airport,
|
199
199
|
and other travel related APIs.
|
@@ -224,6 +224,9 @@ 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/airport.rb
|
228
|
+
- lib/amadeus/namespaces/airport/predictions.rb
|
229
|
+
- lib/amadeus/namespaces/airport/predictions/on_time.rb
|
227
230
|
- lib/amadeus/namespaces/booking.rb
|
228
231
|
- lib/amadeus/namespaces/booking/hotel_bookings.rb
|
229
232
|
- lib/amadeus/namespaces/core.rb
|
@@ -241,8 +244,8 @@ files:
|
|
241
244
|
- lib/amadeus/namespaces/shopping.rb
|
242
245
|
- lib/amadeus/namespaces/shopping/flight_dates.rb
|
243
246
|
- lib/amadeus/namespaces/shopping/flight_destinations.rb
|
244
|
-
- lib/amadeus/namespaces/shopping/
|
245
|
-
- lib/amadeus/namespaces/shopping/
|
247
|
+
- lib/amadeus/namespaces/shopping/flight_offers_search.rb
|
248
|
+
- lib/amadeus/namespaces/shopping/flight_offers_search/prediction.rb
|
246
249
|
- lib/amadeus/namespaces/shopping/hotel_offer.rb
|
247
250
|
- lib/amadeus/namespaces/shopping/hotel_offers.rb
|
248
251
|
- lib/amadeus/namespaces/shopping/hotel_offers_by_hotel.rb
|
@@ -252,6 +255,9 @@ files:
|
|
252
255
|
- lib/amadeus/namespaces/travel/analytics/air_traffic/booked.rb
|
253
256
|
- lib/amadeus/namespaces/travel/analytics/air_traffic/busiest_period.rb
|
254
257
|
- lib/amadeus/namespaces/travel/analytics/air_traffic/traveled.rb
|
258
|
+
- lib/amadeus/namespaces/travel/predictions.rb
|
259
|
+
- lib/amadeus/namespaces/travel/predictions/flight_delay.rb
|
260
|
+
- lib/amadeus/namespaces/travel/predictions/trip_purpose.rb
|
255
261
|
- lib/amadeus/version.rb
|
256
262
|
homepage: https://github.com/amadeus4dev/amadeus-ruby
|
257
263
|
licenses:
|
@@ -265,7 +271,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
265
271
|
requirements:
|
266
272
|
- - ">="
|
267
273
|
- !ruby/object:Gem::Version
|
268
|
-
version: 2.
|
274
|
+
version: 2.4.0
|
269
275
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
270
276
|
requirements:
|
271
277
|
- - ">="
|
@@ -1,47 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Amadeus
|
4
|
-
module Namespaces
|
5
|
-
class Shopping
|
6
|
-
# A namespaced client for the
|
7
|
-
# +/v1/shopping/flight-offers+ endpoints
|
8
|
-
#
|
9
|
-
# Access via the +Amadeus::Client+ object
|
10
|
-
#
|
11
|
-
# amadeus = Amadeus::Client.new
|
12
|
-
# amadeus.shopping.flight_offers
|
13
|
-
#
|
14
|
-
class FlightOffers < Amadeus::Client::Decorator
|
15
|
-
# The namespace for the Prediction API:
|
16
|
-
#
|
17
|
-
# @return [Amadeus::Namespaces::Shopping::FlightOffers::Prediction]
|
18
|
-
# @example
|
19
|
-
# amadeus.shopping.flight_offers.prediction
|
20
|
-
#
|
21
|
-
def prediction
|
22
|
-
Amadeus::Namespaces::Shopping::FlightOffers::Prediction.new(client)
|
23
|
-
end
|
24
|
-
# Find the cheapest bookable flights.
|
25
|
-
#
|
26
|
-
# @option params [String] :origin City/Airport IATA code from which the
|
27
|
-
# flight will depart. BOS, for example.
|
28
|
-
# @option params [String] :destination City/Airport IATA code to which
|
29
|
-
# the traveler is going. PAR, for example
|
30
|
-
# @return [Amadeus::Response] a parsed response
|
31
|
-
# @raise [Amadeus::Base] an exception if the call failed
|
32
|
-
# @example Find the cheapest flight offers from New-York to Madrid,
|
33
|
-
# for the first of August 2020
|
34
|
-
# amadeus.shopping.flight_offers.get(
|
35
|
-
# origin: 'NYC',
|
36
|
-
# destination: 'MAD',
|
37
|
-
# departureDate: '2020-08-01'
|
38
|
-
# )
|
39
|
-
#
|
40
|
-
|
41
|
-
def get(params = {})
|
42
|
-
client.get('/v1/shopping/flight-offers', params)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|