amadeus 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4a23a2c80c517339250f297ad7387205daf2614b170c42a86e3bbb9325bfa67
4
- data.tar.gz: 8af63e1c90db57ea0d0390a8b8d6965bb4ed8499b1749a5ed23e73ce7a0c0003
3
+ metadata.gz: 33afbcef68b900474c70352624925efda0d95a2cd97426bfa30297b736d94c5f
4
+ data.tar.gz: bef8a5c017e946d1ed34af797ee40ddfdf7b389cc8784dfa1804cc3aa348f57d
5
5
  SHA512:
6
- metadata.gz: 9faf86fecd19ff97b2923f4de98a921527629576a3db17e95a4ff4744a1201c83dbe56e40ba6634d5aa8feac17683d2270dcb8084c40331cedbf653f4195d30a
7
- data.tar.gz: 5270563733e24fbe0e7fdbf60712f3c7c4fd305ae534576ac6a3e5f7d60cdf4c410bfb5bbf069d318fa7593f27c29fd1e8de7a910337b432196acaa9a9be98d3
6
+ metadata.gz: d239a6e9a1faf94826954eb219f8e790106e4b6c0f987c1752757042798aa9995ac84fe7cc9bea1a93454ce7e7e18606541d78a37cfa09cc03a473760a97dad7
7
+ data.tar.gz: 9c41fcfd7266d6f74014a282bab7a1660daf0f532e7777a6ee7c8a140d84c94a698036a86fcdc214983a42f6e19674aa7920c55762d434acfd389d5f9e2b7331
@@ -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
@@ -1,4 +1,8 @@
1
1
  # Changelog
2
+ ## 3.2.0 - 2019-05-08
3
+ Release of the [Flight Choice Prediction API](https://developers.amadeus.com/self-service/category/air/api-doc/flight-choice-prediction)
4
+
5
+ > 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.
2
6
  ## 3.1.0 - 2019-03-25
3
7
  Release of the [Point of Interest API](https://developers.amadeus.com/self-service/category/210/api-doc/55)
4
8
 
data/README.md CHANGED
@@ -183,6 +183,9 @@ amadeus.shopping.flight_dates.get(origin: 'MAD', destination: 'MUC')
183
183
  # Flight Low-fare Search
184
184
  amadeus.shopping.flight_offers.get(origin: 'NYC', destination: 'MAD', departureDate: '2019-08-01')
185
185
 
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)
188
+
186
189
  # Flight Check-in Links
187
190
  amadeus.reference_data.urls.checkin_links.get(airlineCode: 'BA')
188
191
 
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency 'guard-rake', '~> 1.0'
33
33
  spec.add_development_dependency 'guard-yard', '~> 2.2'
34
34
  spec.add_development_dependency 'rake', '~> 12.3'
35
+ spec.add_development_dependency 'rb-readline', '~> 0.5.5'
35
36
  spec.add_development_dependency 'rspec', '~> 3.7'
36
37
  spec.add_development_dependency 'rubocop', '0.59'
37
38
  spec.add_development_dependency 'simplecov', '~> 0.15'
@@ -22,6 +22,7 @@ require 'amadeus/namespaces/reference_data/locations/points_of_interest'
22
22
  require 'amadeus/namespaces/reference_data/locations/points_of_interest/by_square'
23
23
  require 'amadeus/namespaces/shopping/flight_destinations'
24
24
  require 'amadeus/namespaces/shopping/flight_offers'
25
+ require 'amadeus/namespaces/shopping/flight_offers/prediction'
25
26
  require 'amadeus/namespaces/shopping/flight_dates'
26
27
  require 'amadeus/namespaces/shopping/hotel_offers'
27
28
  require 'amadeus/namespaces/shopping/hotel_offer'
@@ -111,8 +111,13 @@ module Amadeus
111
111
  def add_post_data(request)
112
112
  return unless @verb == :POST
113
113
 
114
- @headers['Content-Type'] = 'application/x-www-form-urlencoded'
115
- request.form_data = @params
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)
@@ -12,6 +12,15 @@ module Amadeus
12
12
  # amadeus.shopping.flight_offers
13
13
  #
14
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
15
24
  # Find the cheapest bookable flights.
16
25
  #
17
26
  # @option params [String] :origin City/Airport IATA code from which the
@@ -28,6 +37,7 @@ module Amadeus
28
37
  # departureDate: '2019-08-01'
29
38
  # )
30
39
  #
40
+
31
41
  def get(params = {})
32
42
  client.get('/v1/shopping/flight-offers', params)
33
43
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amadeus
4
+ module Namespaces
5
+ class Shopping
6
+ class FlightOffers
7
+ # A namespaced client for the
8
+ # +/v1/shopping/flight-offers/prediction+ endpoints
9
+ #
10
+ # Access via the +Amadeus::Client+ object
11
+ #
12
+ # amadeus = Amadeus::Client.new
13
+ # amadeus.shopping.flight-offers.prediction
14
+ #
15
+ class Prediction < Amadeus::Client::Decorator
16
+ # Returns a list of flight offers including a choice prediction for each itineary.
17
+ #
18
+ # @option body [JSON] :body JSON response of the Flight Low-fare Search API
19
+ # @return [Amadeus::Response] a parsed response
20
+ # @raise [Amadeus::Base] an exception if the call
21
+ # failed
22
+ # @example
23
+ # amadeus.shopping.flight_offers.prediction.post(flight_offers_response.body)
24
+ #
25
+ def post(params = {})
26
+ client.post('/v1/shopping/flight-offers/prediction', params)
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Amadeus
4
4
  # The current client version
5
- VERSION = '3.1.0'.freeze
5
+ VERSION = '3.2.0'.freeze
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amadeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amadeus
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2019-04-01 00:00:00.000000000 Z
13
+ date: 2019-05-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: awesome_print
@@ -96,6 +96,20 @@ dependencies:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
98
  version: '12.3'
99
+ - !ruby/object:Gem::Dependency
100
+ name: rb-readline
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: 0.5.5
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: 0.5.5
99
113
  - !ruby/object:Gem::Dependency
100
114
  name: rspec
101
115
  requirement: !ruby/object:Gem::Requirement
@@ -224,6 +238,7 @@ files:
224
238
  - lib/amadeus/namespaces/shopping/flight_dates.rb
225
239
  - lib/amadeus/namespaces/shopping/flight_destinations.rb
226
240
  - lib/amadeus/namespaces/shopping/flight_offers.rb
241
+ - lib/amadeus/namespaces/shopping/flight_offers/prediction.rb
227
242
  - lib/amadeus/namespaces/shopping/hotel_offer.rb
228
243
  - lib/amadeus/namespaces/shopping/hotel_offers.rb
229
244
  - lib/amadeus/namespaces/shopping/hotel_offers_by_hotel.rb