amadeus 1.1.0 → 2.0.0

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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +38 -0
  3. data/CHANGELOG.md +35 -0
  4. data/README.md +35 -33
  5. data/amadeus.gemspec +3 -3
  6. data/lib/amadeus.rb +2 -1
  7. data/lib/amadeus/client.rb +2 -2
  8. data/lib/amadeus/client/access_token.rb +1 -0
  9. data/lib/amadeus/client/decorator.rb +1 -0
  10. data/lib/amadeus/client/errors.rb +2 -0
  11. data/lib/amadeus/client/http.rb +1 -0
  12. data/lib/amadeus/client/pagination.rb +1 -0
  13. data/lib/amadeus/client/request.rb +3 -0
  14. data/lib/amadeus/client/response/parser.rb +1 -0
  15. data/lib/amadeus/client/validator.rb +1 -0
  16. data/lib/amadeus/namespaces/reference_data/airlines.rb +3 -3
  17. data/lib/amadeus/namespaces/reference_data/urls/checkin_links.rb +3 -3
  18. data/lib/amadeus/namespaces/shopping/flight_dates.rb +3 -3
  19. data/lib/amadeus/namespaces/shopping/flight_destinations.rb +2 -2
  20. data/lib/amadeus/namespaces/shopping/flight_offers.rb +5 -4
  21. data/lib/amadeus/namespaces/travel/analytics.rb +0 -10
  22. data/lib/amadeus/namespaces/travel/analytics/air_traffic.rb +26 -3
  23. data/lib/amadeus/namespaces/travel/analytics/air_traffic/booked.rb +8 -7
  24. data/lib/amadeus/namespaces/travel/analytics/air_traffic/busiest_period.rb +4 -4
  25. data/lib/amadeus/namespaces/travel/analytics/air_traffic/searched.rb +46 -0
  26. data/lib/amadeus/namespaces/travel/analytics/air_traffic/searched_by_destination.rb +54 -0
  27. data/lib/amadeus/namespaces/travel/analytics/air_traffic/traveled.rb +9 -7
  28. data/lib/amadeus/version.rb +1 -1
  29. metadata +12 -8
  30. data/lib/amadeus/namespaces/travel/analytics/fare_searches.rb +0 -46
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77b263da6fa9f3a99fca139c2bd0857dc81ffbde4e80901e18becd1a2f109e77
4
- data.tar.gz: cf75057bd42b724f96ff1aeae897965cc9cae19f609f717835986669c595e137
3
+ metadata.gz: a30ea6344ae22d11df337a484c13e074a60e59e60807d00841987be4b6172d91
4
+ data.tar.gz: ab8c30fcc9ae6da0b7fb4e999fa2d4ae422027835776f2fb9cdcb4d37d60846c
5
5
  SHA512:
6
- metadata.gz: c30c255a1508a6143d1b857d0149a86e63060117a62a4112acc28087be932f1ec4e86977490ae01cb63d1bb96f9eb5abe8a0d3f0ac0cc674c991042424f262f7
7
- data.tar.gz: 8b79e44597f7e3b822a1d2d316ad997fceff08f6e42b89ec0401a52eca203cf6402a8dd6becfeeab88060026f314ad55a3316b36c18fe7b22251af52d16e3eb0
6
+ metadata.gz: bc4ca3df59611e1d592a16f13f81496bd54fc6c381777f24ce148a4f077abb523e1363e14940dd727746ce74c4e310af59b66903f822d46ea9fe268d29ddc870
7
+ data.tar.gz: 331719a2fb0cb21758e86efefbfd2a541c3ce04d16767b875734d1bcab62dc40e683a02d36a2a4ce567165d85d75924e642954ec5175b156bca48581cdbf92b9
@@ -0,0 +1,38 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2018-11-12 16:24:14 +0100 using RuboCop version 0.59.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # Cop supports --auto-correct.
11
+ Layout/SpaceAfterComma:
12
+ Exclude:
13
+ - 'amadeus.gemspec'
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
+ # Offense count: 1
23
+ # Configuration parameters: CountComments, ExcludedMethods.
24
+ # ExcludedMethods: refine
25
+ Metrics/BlockLength:
26
+ Max: 26
27
+
28
+ # Offense count: 1
29
+ # Cop supports --auto-correct.
30
+ Style/IfUnlessModifier:
31
+ Exclude:
32
+ - 'lib/amadeus/client/decorator.rb'
33
+
34
+ # Offense count: 7
35
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
36
+ # URISchemes: http, https
37
+ Metrics/LineLength:
38
+ Max: 97
@@ -1,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.0.0 - 2018-10-12
4
+
5
+ [Flight Most Searched Destinations](https://developers.amadeus.com/self-service/category/203/api-doc/6): Redesign of the API - Split the previous endpoint in 2 endpoints:
6
+ * 1st endpoint to find the most searched destinations
7
+ * 2nd endpoint to have more data about a dedicated origin & destination
8
+
9
+ [Flight Most Booked Destinations](https://developers.amadeus.com/self-service/category/203/api-doc/6):
10
+ * Rename origin to originCityCode
11
+
12
+ [Flight Most Traveled Destinations](https://developers.amadeus.com/self-service/category/203/api-doc/7):
13
+ * Rename origin in originCityCode
14
+
15
+ [Flight Check-in Links](https://developers.amadeus.com/self-service/category/203/api-doc/8):
16
+ * Rename airline to airlineCode
17
+
18
+ [Airport & City Search](https://developers.amadeus.com/self-service/category/203/api-doc/10):
19
+ * Remove parameter onlyMajor
20
+
21
+ [Airport Nearest Relevant](https://developers.amadeus.com/self-service/category/203/api-doc/9):
22
+ * Add radius as parameter
23
+
24
+ [Airline Code Lookup](https://developers.amadeus.com/self-service/category/203/api-doc/26):
25
+ * Regroup parameters _IATACode_ and _ICAOCode_ under the same name _airlineCodes_
26
+
27
+ ## 1.1.0 - 2018-08-01
28
+
29
+ New version of the ruby gem to support our 3 new endpoints:
30
+
31
+ * [Flight Most Booked Destinations](https://developers.amadeus.com/self-service/category/203/api-doc/27)
32
+
33
+ * [Flight Busiest Traveling Period](https://developers.amadeus.com/self-service/category/203/api-doc/28)
34
+
35
+ * [Airline Code Lookup](https://developers.amadeus.com/self-service/category/203/api-doc/26)
36
+
37
+
3
38
  ## 1.0.0 - 2018-04-19
4
39
 
5
40
  The first stable version of the Amadeus for Developers ruby SDK
data/README.md CHANGED
@@ -34,13 +34,12 @@ your first application.
34
34
  require 'amadeus'
35
35
 
36
36
  amadeus = Amadeus::Client.new({
37
- client_id: '[YOUR_CLIENT_ID]',
38
- client_secret: '[YOUR_CLIENT_SECRET]'
37
+ client_id: 'REPLACE_BY_YOUR_API_KEY',
38
+ client_secret: 'REPLACE_BY_YOUR_API_SECRET'
39
39
  })
40
40
 
41
41
  begin
42
- puts amadeus.reference_data.urls.checkin_links.get({ airline: '1X' })
43
- # => {"meta"=>{"count"=>2, "links"=>{"self"=>"https://test.api.amadeus.com...
42
+ puts amadeus.reference_data.urls.checkin_links.get({ airline: 'BA' })
44
43
  rescue Amadeus::ResponseError => error
45
44
  puts error
46
45
  end
@@ -52,10 +51,10 @@ The client can be initialized directly.
52
51
 
53
52
  ```rb
54
53
  # Initialize using parameters
55
- amadeus = Amadeus::Client.new(client_id: '...', client_secret: '...')
54
+ amadeus = Amadeus::Client.new(client_id: 'REPLACE_BY_YOUR_API_KEY', client_secret: 'REPLACE_BY_YOUR_API_SECRET')
56
55
  ```
57
56
 
58
- Alternatively it can be initialized without any paramters if the environment
57
+ Alternatively it can be initialized without any parameters if the environment
59
58
  variables `AMADEUS_CLIENT_ID` and `AMADEUS_CLIENT_SECRET` are present.
60
59
 
61
60
  ```rb
@@ -91,10 +90,10 @@ in-depth information about every SDK method, its arguments and return types.
91
90
 
92
91
  This library conveniently maps every API path to a similar path.
93
92
 
94
- For example, `GET /v2/reference-data/urls/checkin-links?airline=1X` would be:
93
+ For example, `GET /v2/reference-data/urls/checkin-links?airline=BA` would be:
95
94
 
96
95
  ```rb
97
- amadeus.reference_data.urls.checkin_links.get(airline: '1X')
96
+ amadeus.reference_data.urls.checkin_links.get(airline: 'BA')
98
97
  ```
99
98
 
100
99
  Similarly, to select a resource by ID, you can pass in the ID to the **singular** path.
@@ -108,7 +107,7 @@ amadeus.hotel(123).offer(234).get(...)
108
107
  You can make any arbitrary API call as well directly with the `.get` method:
109
108
 
110
109
  ```rb
111
- amadeus.get('/v2/reference-data/urls/checkin-links', airline: '1X')
110
+ amadeus.get('/v2/reference-data/urls/checkin-links', airline: 'BA')
112
111
  ```
113
112
 
114
113
  ## Response
@@ -124,8 +123,8 @@ response = amadeus.reference_data.locations.get(
124
123
  subType: Amadeus::Location::ANY
125
124
  )
126
125
 
127
- p reponse.body #=> The raw response, as a string
128
- p reponse.result #=> The body parsed as JSON, if the result was parsable
126
+ p response.body #=> The raw response, as a string
127
+ p response.result #=> The body parsed as JSON, if the result was parsable
129
128
  p response.data #=> The list of locations, extracted from the JSON
130
129
  ```
131
130
 
@@ -153,8 +152,8 @@ The SDK makes it easy to add your own logger.
153
152
  require 'logger'
154
153
 
155
154
  amadeus = Amadeus::Client.new(
156
- client_id: '...',
157
- client_secret: '...',
155
+ client_id: 'REPLACE_BY_YOUR_API_KEY',
156
+ client_secret: 'REPLACE_BY_YOUR_API_SECRET',
158
157
  logger: Logger.new(STDOUT)
159
158
  )
160
159
  ```
@@ -168,59 +167,62 @@ variable.
168
167
  require 'logger'
169
168
 
170
169
  amadeus = Amadeus::Client.new(
171
- client_id: '...',
172
- client_secret: '...',
170
+ client_id: 'REPLACE_BY_YOUR_API_KEY',
171
+ client_secret: 'REPLACE_BY_YOUR_API_SECRET',
173
172
  log_level: 'debug' # or "warn" or "silent", defaults to "silent"
174
173
  )
175
174
  ```
176
175
  ## List of supported endpoints
177
176
  ```rb
178
- # Flight Cheapest Date Search
179
- amadeus.shopping.flight_dates.get(origin: 'NCE', destination: 'PAR', duration: 1)
180
-
181
177
  # Flight Inspiration Search
182
178
  amadeus.shopping.flight_destinations.get(origin: 'MAD')
183
179
 
180
+ # Flight Cheapest Date Search
181
+ amadeus.shopping.flight_dates.get(origin: 'NYC', destination: 'MAD')
182
+
184
183
  # Flight Low-fare Search
185
- amadeus.shopping.flight_offers.get(origin: 'MAD', destination: 'OPO', departureDate: '2018-07-08')
184
+ amadeus.shopping.flight_offers.get(origin: 'NYC', destination: 'MAD', departureDate: '2019-08-01')
186
185
 
187
186
  # Flight Check-in Links
188
- amadeus.reference_data.urls.checkin_links.get({ airline: 'BA' })
187
+ amadeus.reference_data.urls.checkin_links.get({ airlineCode: 'BA' })
189
188
 
190
189
  # Airline Code Lookup
191
- amadeus.reference_data.airlines.get({ IATAcode: 'U2' })
190
+ amadeus.reference_data.airlines.get({ airlineCodes: 'U2' })
192
191
 
193
192
  # Airport & City Search (autocomplete)
194
- # Find all the cities and airports starting by the keyword 'Lon'
193
+ # Find all the cities and airports starting by the keyword 'LON'
195
194
  amadeus.reference_data.locations.get(
196
- keyword: 'Lon',
195
+ keyword: 'LON',
197
196
  subType: Amadeus::Location::ANY
198
197
  )
199
198
  # Get a specific city or airport based on its id
200
199
  amadeus.reference_data.location('ALHR').get
201
200
 
202
- # Airport Nearest Relevant
201
+ # Airport Nearest Relevant
203
202
  amadeus.reference_data.locations.airports.get(longitude: 49.0000, latitude: 2.55)
204
203
 
205
204
  # Flight Most Searched Destinations
206
- amadeus.travel.analytics.fare_searches.get(origin: 'NCE', sourceCountry: 'FR', period: '2017-08')
207
-
208
- # Flight Most Traveled Destinations
209
- amadeus.travel.analytics.air_traffic.traveled.get(origin: 'NCE', period: '2017-08')
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')
210
209
 
211
210
  # Flight Most Booked Destinations
212
- amadeus.travel.analytics.air_traffic.booked.get(origin: 'NCE', period: '2017-08')
211
+ amadeus.travel.analytics.air_traffic.booked.get(originCityCode: 'MAD', period: '2017-08')
212
+
213
+ # Flight Most Traveled Destinations
214
+ amadeus.travel.analytics.air_traffic.traveled.get(originCityCode: 'MAD', period: '2017-01')
213
215
 
214
216
  # Flight Busiest Period
215
217
  amadeus.travel.analytics.air_traffic.busiest_period.get(
216
- city: 'NCE',
218
+ cityCode: 'MAD',
217
219
  period: '2017',
218
- direction = Amadeus::Direction::ARRIVING
220
+ direction: Amadeus::Direction::ARRIVING
219
221
  )
220
222
 
221
223
  # Hotel Search API
222
224
  # Get list of hotels by cityCode
223
- amadeus.shopping.hotel_offers.get(cityCode: 'PAR')
225
+ amadeus.shopping.hotel_offers.get(cityCode: 'MAD')
224
226
  # Get list of offers for a specific hotel
225
227
  amadeus.shopping.hotel('SMPARCOL').hotel_offers.get
226
228
  # Confirm the availability of a specific offer for a specific hotel
@@ -246,4 +248,4 @@ to help you. You can find us on
246
248
  [gem]: https://rubygems.org/gems/amadeus
247
249
  [travis]: http://travis-ci.org/amadeus4dev/amadeus-ruby
248
250
  [support]: http://developers.amadeus.com/support
249
- [codeclimate]: https://codeclimate.com/github/amadeus4dev/amadeus-ruby
251
+ [codeclimate]: https://codeclimate.com/github/amadeus4dev/amadeus-ruby
@@ -5,8 +5,8 @@ require 'amadeus/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'amadeus'
7
7
  spec.version = Amadeus::VERSION
8
- spec.authors = ['Amadeus', 'Cristiano Betta']
9
- spec.email = ['developer@amadeus.com', 'cristiano@betta.io']
8
+ spec.authors = ['Amadeus', 'Cristiano Betta','Anthony Roux']
9
+ spec.email = ['developer@amadeus.com', 'cristiano@betta.io','anthony.roux@amadeus.com']
10
10
 
11
11
  spec.summary = 'Amadeus travel APIs'
12
12
  spec.description = <<-DESCRIPTION
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'guard-yard', '~> 2.2'
34
34
  spec.add_development_dependency 'rake', '~> 12.3'
35
35
  spec.add_development_dependency 'rspec', '~> 3.7'
36
- spec.add_development_dependency 'rubocop', '~> 0.52'
36
+ spec.add_development_dependency 'rubocop', '0.59'
37
37
  spec.add_development_dependency 'simplecov', '~> 0.15'
38
38
  spec.add_development_dependency 'vcr', '~> 4.0'
39
39
  spec.add_development_dependency 'webmock', '~> 3.3'
@@ -26,10 +26,11 @@ require 'amadeus/namespaces/shopping/hotel'
26
26
  require 'amadeus/namespaces/shopping/hotel/offer'
27
27
  require 'amadeus/namespaces/shopping/hotel/hotel_offers'
28
28
  require 'amadeus/namespaces/travel/analytics'
29
- require 'amadeus/namespaces/travel/analytics/fare_searches'
30
29
  require 'amadeus/namespaces/travel/analytics/air_traffic'
31
30
  require 'amadeus/namespaces/travel/analytics/air_traffic/traveled'
32
31
  require 'amadeus/namespaces/travel/analytics/air_traffic/booked'
32
+ require 'amadeus/namespaces/travel/analytics/air_traffic/searched'
33
+ require 'amadeus/namespaces/travel/analytics/air_traffic/searched_by_destination'
33
34
  require 'amadeus/namespaces/travel/analytics/air_traffic/busiest_period'
34
35
 
35
36
  # The namespace for the files used to make API
@@ -47,8 +47,8 @@ module Amadeus
47
47
  # Initialize using your credentials:
48
48
  #
49
49
  # amadeus = Amadeus::Client.new(
50
- # client_id: 'YOUR_CLIENT_ID',
51
- # client_secret: 'YOUR_CLIENT_SECRET'
50
+ # client_id: 'REPLACE_BY_YOUR_API_KEY',
51
+ # client_secret: 'REPLACE_BY_YOUR_API_SECRET'
52
52
  # )
53
53
  #
54
54
  # Alternatively, initialize the library using
@@ -26,6 +26,7 @@ module Amadeus
26
26
  # or refreshes it if it is not (or about to expire)
27
27
  def token
28
28
  return @access_token if @access_token && !needs_refresh?
29
+
29
30
  update_access_token
30
31
  @access_token
31
32
  end
@@ -20,6 +20,7 @@ module Amadeus
20
20
  if client.nil?
21
21
  raise(ArgumentError, 'Missing required parameter: Amadeus::Client')
22
22
  end
23
+
23
24
  @client = client
24
25
  end
25
26
  end
@@ -36,6 +36,7 @@ module Amadeus
36
36
  def log(client)
37
37
  # :nocov:
38
38
  return unless client.log_level == 'warn'
39
+
39
40
  client.logger.warn("Amadeus #{@code}") do
40
41
  JSON.pretty_generate(@description) if @description
41
42
  end
@@ -64,6 +65,7 @@ module Amadeus
64
65
  # Determines the longer description, printed after the initial error
65
66
  def long_description
66
67
  return '' unless response && response.parsed
68
+
67
69
  message = ''
68
70
  message += error_description if response.result['error_description']
69
71
  message += errors_description if response.result['errors']
@@ -123,6 +123,7 @@ module Amadeus
123
123
  def log(object)
124
124
  # :nocov:
125
125
  return unless @log_level == 'debug'
126
+
126
127
  logger.debug(object.class.name.to_s) do
127
128
  JSON.pretty_generate(
128
129
  ::Hash[object.instance_variables.map do |ivar|
@@ -93,6 +93,7 @@ module Amadeus
93
93
  def page(name, response)
94
94
  page_number = page_number_for(name, response)
95
95
  return nil unless page_number
96
+
96
97
  params = response.request.params.clone
97
98
  params['page'] ||= {}
98
99
  params['page']['offset'] = page_number
@@ -110,12 +110,14 @@ module Amadeus
110
110
 
111
111
  def add_post_data(request)
112
112
  return unless @verb == :POST
113
+
113
114
  @headers['Content-Type'] = 'application/x-www-form-urlencoded'
114
115
  request.form_data = @params
115
116
  end
116
117
 
117
118
  def add_bearer_token(_request)
118
119
  return if @bearer_token.nil?
120
+
119
121
  @headers['Authorization'] = @bearer_token
120
122
  end
121
123
 
@@ -128,6 +130,7 @@ module Amadeus
128
130
  def build_user_agent
129
131
  user_agent = "amadeus-ruby/#{@client_version} ruby/#{@language_version}"
130
132
  return user_agent unless @app_id
133
+
131
134
  user_agent + " #{@app_id}/#{@app_version}"
132
135
  end
133
136
 
@@ -39,6 +39,7 @@ module Amadeus
39
39
  def parse_json(http_response, client)
40
40
  @body = http_response.body
41
41
  return unless json?(http_response)
42
+
42
43
  json = JSON.parse(@body)
43
44
  @parsed = true
44
45
  json
@@ -87,6 +87,7 @@ module Amadeus
87
87
  def warn_on_unrecognized_options(options, logger, recognized_options)
88
88
  options.each_key do |key|
89
89
  next if recognized_options.include?(key.to_sym)
90
+
90
91
  logger.warn('Amadeus::Client::Validator') do
91
92
  # :nocov:
92
93
  "Unrecognized option: #{key}"
@@ -13,12 +13,12 @@ module Amadeus
13
13
  #
14
14
  class Airlines < Amadeus::Client::Decorator
15
15
  # Returns the airline name for a given IATA code
16
- # @option params [String] :airline airline ID - required
17
- # @option params [String] :language (en-GB) the locale for the links
16
+ # @option params [String] :airlineCodes airline IATA code or ICAO code
17
+ # - required
18
18
  # @return [Amadeus::Response] a parsed response
19
19
  # @raise [Amadeus::Base] an exception if the call failed
20
20
  # @example what is the name of airline code 'U2'
21
- # amadeus.reference_data.airlines.get(IATACode: 'U2')
21
+ # amadeus.reference_data.airlines.get(airlineCodes: 'U2')
22
22
  #
23
23
  def get(params = {})
24
24
  client.get('/v1/reference-data/airlines', params)
@@ -16,12 +16,12 @@ module Amadeus
16
16
  # Returns the checkin links for an airline, for the
17
17
  # language of your choice
18
18
  #
19
- # @option params [String] :airline airline ID - required
19
+ # @option params [String] :airlineCode airline ID - required
20
20
  # @option params [String] :language (en-GB) the locale for the links
21
21
  # @return [Amadeus::Response] a parsed response
22
22
  # @raise [Amadeus::Base] an exception if the call failed
23
- # @example Find a the checkin links for Branson AirExpress
24
- # amadeus.reference_data.urls.checkin_links.get(airline: 'BA')
23
+ # @example Find a the checkin links for British Airways
24
+ # amadeus.reference_data.urls.checkin_links.get(airlineCode: 'BA')
25
25
  #
26
26
  def get(params = {})
27
27
  client.get('/v2/reference-data/urls/checkin-links', params)
@@ -20,9 +20,9 @@ module Amadeus
20
20
  # the flight is going. BOS, for example.
21
21
  # @return [Amadeus::Response] a parsed response
22
22
  # @raise [Amadeus::Base] an exception if the call failed
23
- # @example Find the cheapest flight from London Heathrow to Paris
24
- # amadeus.shopping.flight_dates.get(origin: 'LHR',
25
- # destination: 'PAR')
23
+ # @example Find the cheapest flight dates from New-York to Madrid
24
+ # amadeus.shopping.flight_dates.get(origin: 'NYC',
25
+ # destination: 'MAD')
26
26
  #
27
27
  def get(params = {})
28
28
  client.get('/v1/shopping/flight-dates', params)
@@ -18,8 +18,8 @@ module Amadeus
18
18
  # flight will depart. BOS, for example.
19
19
  # @return [Amadeus::Response] a parsed response
20
20
  # @raise [Amadeus::Base] an exception if the call failed
21
- # @example Find the cheapest destination from London Heathrow
22
- # amadeus.shopping.flight_destinations.get(origin: 'LHR')
21
+ # @example Find the cheapest destinations from Madrid
22
+ # amadeus.shopping.flight_destinations.get(origin: 'MAD')
23
23
  #
24
24
  def get(params = {})
25
25
  client.get('/v1/shopping/flight-destinations', params)
@@ -20,11 +20,12 @@ module Amadeus
20
20
  # the traveler is going. PAR, for example
21
21
  # @return [Amadeus::Response] a parsed response
22
22
  # @raise [Amadeus::Base] an exception if the call failed
23
- # @example Find the cheapest destination from London to Paris for Xmas
23
+ # @example Find the cheapest flight offers from New-York to Madrid,
24
+ # for the first of August 2019
24
25
  # amadeus.shopping.flight_offers.get(
25
- # origin: 'LHR',
26
- # destination: 'LAX',
27
- # departureDate: '2017-12-24'
26
+ # origin: 'NYC',
27
+ # destination: 'MAD',
28
+ # departureDate: '2019-08-01'
28
29
  # )
29
30
  #
30
31
  def get(params = {})
@@ -12,16 +12,6 @@ module Amadeus
12
12
  # amadeus.travel.analytics
13
13
  #
14
14
  class Analytics < Amadeus::Client::Decorator
15
- # The namespace for the FareSearches API:
16
- #
17
- # @return [Amadeus::Namespaces::Travel::Analytics::FareSearches]
18
- # @example
19
- # amadeus.travel.analytics.fare_searches
20
- #
21
- def fare_searches
22
- Amadeus::Namespaces::Travel::Analytics::FareSearches.new(client)
23
- end
24
-
25
15
  # The namespace for the travel Analytics APIs:
26
16
  #
27
17
  # @return [Amadeus::Namespaces::Travel::Analytics]
@@ -28,7 +28,7 @@ module Amadeus
28
28
  # The namespace for the Booked API:
29
29
  #
30
30
  # @return
31
- # [Amadeus::Namespaces::Travel::Analytics::AirTraffic::Booked]
31
+ # [Amadeus::Namespaces::Travel::Analytics::AirTraffic::Booked]
32
32
  # @example
33
33
  # amadeus.travel.analytics.air_traffic.booked
34
34
  def booked
@@ -37,12 +37,35 @@ module Amadeus
37
37
  )
38
38
  end
39
39
 
40
+ # The namespace for the Searched API:
41
+ #
42
+ # @return
43
+ # [Amadeus::Namespaces::Travel::Analytics::AirTraffic::Searched]
44
+ # @example
45
+ # amadeus.travel.analytics.air_traffic.searched
46
+ def searched
47
+ Amadeus::Namespaces::Travel::Analytics::AirTraffic::Searched.new(
48
+ client
49
+ )
50
+ end
51
+
52
+ # The namespace for the SearchedByDestination API:
53
+ #
54
+ # @return
55
+ # [Amadeus::Namespaces::Travel::Analytics::AirTraffic::SearchedByDestination]
56
+ # @example
57
+ # amadeus.travel.analytics.air_traffic.searched_by_destination
58
+ def searched_by_destination
59
+ Amadeus::Namespaces::Travel::Analytics::AirTraffic::SearchedByDestination
60
+ .new(client)
61
+ end
62
+
40
63
  # The namespace for the Busiest Period API:
41
64
  #
42
65
  # @return
43
- # [Amadeus::Namespaces::Travel::Analytics::AirTraffic::BusiestPeriod]
66
+ # [Amadeus::Namespaces::Travel::Analytics::AirTraffic::BusiestPeriod]
44
67
  # @example
45
- # amadeus.travel.analytics.air_traffic.busiest_period
68
+ # amadeus.travel.analytics.air_traffic.busiest_period
46
69
  def busiest_period
47
70
  Amadeus::Namespaces::Travel::Analytics::AirTraffic::BusiestPeriod
48
71
  .new(client)
@@ -16,17 +16,18 @@ module Amadeus
16
16
  class Booked < Amadeus::Client::Decorator
17
17
  # Returns a list of air traffic reports, based on bookings.
18
18
  #
19
- # @option params [String] :origin IATA code of the origin city -
19
+ # @option params [String] :originCityCode
20
+ # IATA code of the origin city -
20
21
  # e.g. BOS for Boston - required
21
- # @option params [String] :query period when consumers
22
- # are travelling
23
- # in YYYY-MM format
22
+ # @option params [String] :period period when consumers
23
+ # are booking
24
+ # in YYYY-MM format - required
24
25
  # @return [Amadeus::Response] a parsed response
25
26
  # @raise [Amadeus::Base] an exception if the call failed
26
- # @example Find the air traffic from LHR in January 2011
27
+ # @example Find the air traffic from Nice in August 2017
27
28
  # amadeus.travel.analytics.air_traffic.booked.get(
28
- # origin: 'LHR',
29
- # period: '2017-03'
29
+ # originCityCode: 'NCE',
30
+ # period: '2017-08'
30
31
  # )
31
32
  #
32
33
  def get(params = {})
@@ -17,17 +17,17 @@ module Amadeus
17
17
  # Returns the months of the selected year, ordered from busiest
18
18
  # to least busy.
19
19
  #
20
- # @option params [String] :city IATA code of the origin city -
20
+ # @option params [String] :cityCode IATA code of the origin city -
21
21
  # e.g. BOS for Boston - required
22
22
  # @option params [String] :period period when consumers
23
- # are travelling in YYYY format
23
+ # are travelling in YYYY format - required
24
24
  # @option params [String] :direction to select between
25
- # arrivals and departures (default: arrivals)
25
+ # arrivals and departures (default: arrivals) - required
26
26
  # @return [Amadeus::Response] a parsed response
27
27
  # @raise [Amadeus::Base] an exception if the call failed
28
28
  # @example What was the busiest travel period in 2017
29
29
  # amadeus.travel.analytics.air_traffic.busiest_period.get(
30
- # city: 'MAD',
30
+ # cityCode: 'MAD',
31
31
  # period: '2017',
32
32
  # direction: Amadeus::Direction::ARRIVING
33
33
  # )
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amadeus
4
+ module Namespaces
5
+ class Travel
6
+ class Analytics
7
+ class AirTraffic
8
+ # A namespaced client for the
9
+ # +/v1/travel/analytics/air-traffic/searched+ endpoints
10
+ #
11
+ # Access via the +Amadeus::Client+ object
12
+ #
13
+ # amadeus = Amadeus::Client.new
14
+ # amadeus.travel.analytics.air_traffic.searched
15
+ #
16
+ class Searched < Amadeus::Client::Decorator
17
+ # Returns a list of air traffic reports, based on searches.
18
+ #
19
+ # @option params [String] :originCityCode
20
+ # IATA code of the origin city -
21
+ # e.g. MAD for Madrid - required
22
+ # @option params [String] :marketCountryCode
23
+ # IATA code of the country from which the searches were made -
24
+ # e.g. ES for Spain - required
25
+ # @option params [String] :searchPeriod when consumers
26
+ # are searching -
27
+ # in YYYY-MM format - required
28
+ # @return [Amadeus::Response] a parsed response
29
+ # @raise [Amadeus::Base] an exception if the call failed
30
+ # @example Which were the most searched flight destinations
31
+ # from Madrid in August 2017?
32
+ # amadeus.travel.analytics.air_traffic.searched.get(
33
+ # originCityCode: 'MAD',
34
+ # searchPeriod: '2017-08',
35
+ # marketCountryCode: 'ES'
36
+ # )
37
+ #
38
+ def get(params = {})
39
+ client.get('/v1/travel/analytics/air-traffic/searched', params)
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amadeus
4
+ module Namespaces
5
+ class Travel
6
+ class Analytics
7
+ class AirTraffic
8
+ # A namespaced client for the
9
+ # +/v1/travel/analytics/air-traffic/searched_by_destination+ endpoints
10
+ #
11
+ # Access via the +Amadeus::Client+ object
12
+ #
13
+ # amadeus = Amadeus::Client.new
14
+ # amadeus.travel.analytics.air_traffic.searched_by_destination
15
+ #
16
+ class SearchedByDestination < Amadeus::Client::Decorator
17
+ # Returns a list of air traffic reports,
18
+ # based on searches for a dedicated destination.
19
+ #
20
+ # @option params [String] :originCityCode
21
+ # IATA code of the origin city -
22
+ # e.g. NCE for Nice - required
23
+ # @option params [String] :destinationCityCode
24
+ # IATA code of the destinaton city -
25
+ # e.g. PAR for Paris - required
26
+ # @option params [String] :marketCountryCode
27
+ # IATA code of the country from which the searches were made -
28
+ # e.g. FR for France - required
29
+ # @option params [String] :searchPeriod when consumers
30
+ # are searching -
31
+ # in YYYY-MM format - required
32
+ # @return [Amadeus::Response] a parsed response
33
+ # @raise [Amadeus::Base] an exception if the call failed
34
+ # @example How many people in France searched for a trip
35
+ # from Nice to Paris in September 2015?
36
+ # amadeus.travel.analytics.air_traffic.searched_by_destination.get(
37
+ # originCityCode: 'NCE',
38
+ # destinationCityCode: 'PAR',
39
+ # searchPeriod: '2015-09',
40
+ # marketCountryCode: 'FR'
41
+ # )
42
+ #
43
+ def get(params = {})
44
+ client.get(
45
+ '/v1/travel/analytics/air-traffic/searched/by-destination',
46
+ params
47
+ )
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -14,19 +14,21 @@ module Amadeus
14
14
  # amadeus.travel.analytics.air_traffic.traveled
15
15
  #
16
16
  class Traveled < Amadeus::Client::Decorator
17
- # Returns a list of air traffic reports.
17
+ # Returns a list of air traffic reports,
18
+ # based on number of people traveling.
18
19
  #
19
- # @option params [String] :origin IATA code of the origin city -
20
+ # @option params [String] :originCityCode
21
+ # IATA code of the origin city -
20
22
  # e.g. BOS for Boston - required
21
- # @option params [String] :query period when consumers
23
+ # @option params [String] :period period when consumers
22
24
  # are travelling
23
- # in YYYY-MM format
25
+ # in YYYY-MM format - required
24
26
  # @return [Amadeus::Response] a parsed response
25
27
  # @raise [Amadeus::Base] an exception if the call failed
26
- # @example Find the air traffic from LHR in January 2011
28
+ # @example Find the air traffic from Nice in August 2017
27
29
  # amadeus.travel.analytics.air_traffic.traveled.get(
28
- # origin: 'LHR',
29
- # period: '2017-03'
30
+ # originCityCode: 'NCE',
31
+ # period: '2017-08'
30
32
  # )
31
33
  #
32
34
  def get(params = {})
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Amadeus
4
4
  # The current client version
5
- VERSION = '1.1.0'.freeze
5
+ VERSION = '2.0.0'.freeze
6
6
  end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amadeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amadeus
8
8
  - Cristiano Betta
9
+ - Anthony Roux
9
10
  autorequire:
10
11
  bindir: exe
11
12
  cert_chain: []
12
- date: 2018-08-01 00:00:00.000000000 Z
13
+ date: 2018-11-12 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: awesome_print
@@ -113,16 +114,16 @@ dependencies:
113
114
  name: rubocop
114
115
  requirement: !ruby/object:Gem::Requirement
115
116
  requirements:
116
- - - "~>"
117
+ - - '='
117
118
  - !ruby/object:Gem::Version
118
- version: '0.52'
119
+ version: '0.59'
119
120
  type: :development
120
121
  prerelease: false
121
122
  version_requirements: !ruby/object:Gem::Requirement
122
123
  requirements:
123
- - - "~>"
124
+ - - '='
124
125
  - !ruby/object:Gem::Version
125
- version: '0.52'
126
+ version: '0.59'
126
127
  - !ruby/object:Gem::Dependency
127
128
  name: simplecov
128
129
  requirement: !ruby/object:Gem::Requirement
@@ -185,10 +186,12 @@ description: |2
185
186
  email:
186
187
  - developer@amadeus.com
187
188
  - cristiano@betta.io
189
+ - anthony.roux@amadeus.com
188
190
  executables: []
189
191
  extensions: []
190
192
  extra_rdoc_files: []
191
193
  files:
194
+ - ".rubocop_todo.yml"
192
195
  - CHANGELOG.md
193
196
  - LICENSE
194
197
  - README.md
@@ -228,8 +231,9 @@ files:
228
231
  - lib/amadeus/namespaces/travel/analytics/air_traffic.rb
229
232
  - lib/amadeus/namespaces/travel/analytics/air_traffic/booked.rb
230
233
  - lib/amadeus/namespaces/travel/analytics/air_traffic/busiest_period.rb
234
+ - lib/amadeus/namespaces/travel/analytics/air_traffic/searched.rb
235
+ - lib/amadeus/namespaces/travel/analytics/air_traffic/searched_by_destination.rb
231
236
  - lib/amadeus/namespaces/travel/analytics/air_traffic/traveled.rb
232
- - lib/amadeus/namespaces/travel/analytics/fare_searches.rb
233
237
  - lib/amadeus/version.rb
234
238
  homepage: https://github.com/amadeus4dev/amadeus-ruby
235
239
  licenses:
@@ -251,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
255
  version: '0'
252
256
  requirements: []
253
257
  rubyforge_project:
254
- rubygems_version: 2.7.7
258
+ rubygems_version: 2.7.8
255
259
  signing_key:
256
260
  specification_version: 4
257
261
  summary: Amadeus travel APIs
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Amadeus
4
- module Namespaces
5
- class Travel
6
- class Analytics
7
- # A namespaced client for the
8
- # +/v1/travel/analytics/fare-searches+ endpoints
9
- #
10
- # Access via the +Amadeus::Client+ object
11
- #
12
- # amadeus = Amadeus::Client.new
13
- # amadeus.travel.analytics.fare_searches
14
- #
15
- class FareSearches < Amadeus::Client::Decorator
16
- # The Fare Search History API allows to find the number of
17
- # estimated searches from an origin, optionally a destination,
18
- # within a time period when travelers are performing the searches.
19
- #
20
- # @option params [String] :origin IATA code of the origin city
21
- # e.g. BOS for Boston - required
22
- # @option params [String] :sourceCountry IATA code of the
23
- # country from which fare searches were made - e.g. US for
24
- # United States
25
- # @option params [String] :period period of search; can be a year
26
- # or a month or a week. ISO format must be used - e.g. 2015
27
- # for year; 2015-05 for month and 2015-W04 for week. Period
28
- # ranges are not supported. Only periods from year 2011-01 up
29
- # to current year and previous month or week are valid. Future
30
- # dates are not supported.
31
- # @return [Amadeus::Response] a parsed response
32
- # @raise [Amadeus::Base] an exception if the call failed
33
- # @example Find the fare searches for LHR, made from France in 2011
34
- # amadeus.travel.analytics.fare_searches.get(
35
- # origin: 'LHR',
36
- # sourceCountry: 'FR'
37
- # period: '2011'
38
- # )
39
- def get(params = {})
40
- client.get('/v1/travel/analytics/fare-searches', params)
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end