amadeus 5.0.0 → 5.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: daa2f88d0dd02caa16558d86e65df76459220e0e9cdc9f12c4f3345e29bb4be2
4
- data.tar.gz: 6a8c25052107c18810dd9b7d0a22bc2fc489828e88b24aab0f842937794dd43b
3
+ metadata.gz: 3d85348bf45e54be187cc91e512d1958c1a1162ae22d1bdeb3d7171ac78f4272
4
+ data.tar.gz: 06020e4f010c2512ac639e44fcdf36cfbd0492cf6cba07111a6ddb2167b9035d
5
5
  SHA512:
6
- metadata.gz: ce3a0e248e96a067e56172a0fda8a6b614c3dde2e61905130e5ccd86658e96f1e28786b686171d5447bcc1e46e137fb87e6c93c11ec74c132f31233de5471def
7
- data.tar.gz: 72dd837abaee061718587382bd0a81cdf67fd1f6545be39c45d76ed8803f0cffa55bfcba93fe4f4462ad9872d21b1f9d2c1609eeca3d7f3e6529424e0b16c73d
6
+ metadata.gz: 6f775996bc4b672820ac34c79296fca9a8b586a007c067af46335d9f3d9793cff5597c26845171cce8cf81dfc63a836f5a9951f9c18c6864a6d733270764ae10
7
+ data.tar.gz: 0bfa4b4bdc56a8e19b052e95587c96026d9eeda00211e932e2e40bf133c689059432cdb91430721bdbe732742a481f6b924decfe552259b8e1795efa3c0543be
@@ -1,4 +1,8 @@
1
1
  # Changelog
2
+ ## 5.1.0 - 2020-11-26
3
+
4
+ Add support for Safe Place API.
5
+ Add support for retrieve by id for Points Of Interest API
2
6
  ## 5.0.0 - 2020-05-14
3
7
  Release of the Flight Offers Search API.
4
8
 
data/README.md CHANGED
@@ -5,16 +5,13 @@
5
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/d2e15221a502a7d71144/maintainability)](https://codeclimate.com/github/amadeus4dev/amadeus-ruby/maintainability)
6
6
  [![Dependencies](https://github.com/amadeus4dev/amadeus-ruby/raw/master/.github/images/dependencies.svg?sanitize=true)](gem)
7
7
  [![Contact Support](https://github.com/amadeus4dev/amadeus-ruby/raw/master/.github/images/support.svg?sanitize=true)][support]
8
+ [![Discord](https://img.shields.io/discord/696822960023011329?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/cVrFBqx)
8
9
 
9
- Amadeus provides a set of APIs for the travel industry. Flights, Hotels, Locations and more.
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.4+. You can install install it directly or via bundler.
14
+ This gem requires Ruby 2.4+. You can install it directly or via bundler.
18
15
  #### Command line
19
16
  ```bash
20
17
  gem install amadeus
@@ -26,9 +23,7 @@ gem 'amadeus'
26
23
 
27
24
  ## Getting Started
28
25
 
29
- To make your first API call you will need to [register for an Amadeus
30
- Developer Account](https://developers.amadeus.com/create-account) and set up
31
- your first application.
26
+ To make your first API call, you will need to [register](https://developers.amadeus.com/register) for an Amadeus Developer Account and [set up your first application](https://developers.amadeus.com/my-apps).
32
27
 
33
28
  ```rb
34
29
  require 'amadeus'
@@ -54,19 +49,15 @@ The client can be initialized directly.
54
49
  amadeus = Amadeus::Client.new(client_id: 'REPLACE_BY_YOUR_API_KEY', client_secret: 'REPLACE_BY_YOUR_API_SECRET')
55
50
  ```
56
51
 
57
- Alternatively it can be initialized without any parameters if the environment
58
- variables `AMADEUS_CLIENT_ID` and `AMADEUS_CLIENT_SECRET` are present.
52
+ Alternatively, it can be initialized without any parameters if the environment variables `AMADEUS_CLIENT_ID` and `AMADEUS_CLIENT_SECRET` are present.
59
53
 
60
54
  ```rb
61
55
  amadeus = Amadeus::Client.new
62
56
  ```
63
57
 
64
- Your credentials can be found on the [Amadeus
65
- dashboard](https://developers.amadeus.com/my-apps). [Sign
66
- up](https://developers.amadeus.com/create-account) for an account today.
58
+ Your credentials can be found on the [Amadeus dashboard](https://developers.amadeus.com/my-apps).
67
59
 
68
- By default the environment for the SDK is the `:test` environment. To switch to
69
- a production (paid-for) environment please switch the hostname as follows:
60
+ By default, the environment for the SDK is the `:test` environment. To switch to a production (pay-as-you-go) environment please switch the hostname as follows:
70
61
 
71
62
  ```rb
72
63
  amadeus = Amadeus::Client.new(hostname: :production)
@@ -74,34 +65,26 @@ amadeus = Amadeus::Client.new(hostname: :production)
74
65
 
75
66
  ## Documentation
76
67
 
77
- Amadeus has a large set of APIs, and our documentation is here to get you
78
- started today. Head over to our
79
- [Reference](https://amadeus4dev.github.io/amadeus-ruby/) documentation for
80
- in-depth information about every SDK method, its arguments and return types.
68
+ Amadeus has a large set of APIs, and our documentation is here to get you started today. Head over to our [reference documentation](https://amadeus4dev.github.io/amadeus-ruby/) for in-depth information about every SDK method, its arguments and return types.
81
69
 
82
70
 
83
- * [Get Started](https://amadeus4dev.github.io/amadeus-ruby/) documentation
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/FlightOffers.html)
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('D5BEE9D0D08B6678C2F5FAD910DC110BCDA187D21D4FCE68ED423426D0A246BB').get
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'
@@ -236,11 +213,22 @@ amadeus.booking.hotel_bookings.post(offerId, guests, payments)
236
213
  # What are the reviews for the Holiday INN Manhattan and the Hilton London Paddington
237
214
  amadeus.e_reputation.hotel_sentiments.get(hotelIds: 'SJNYCAJA,TELONMFS')
238
215
 
239
- # Point of Interest
216
+ # Points of Interest
240
217
  # What are the popular places in Barcelona (based a geo location and a radius)
241
218
  amadeus.reference_data.locations.points_of_interest.get(latitude: 41.397158, longitude: 2.160873)
242
219
  # What are the popular places in Barcelona? (based on a square)
243
220
  amadeus.reference_data.locations.points_of_interest.by_square.get(north: 41.397158, west: 2.160873, south: 41.394582, east: 2.177181)
221
+ # Returns a single Point of Interest from a given id
222
+ amadeus.reference_data.locations.point_of_interest('9CB40CB5D0').get()
223
+
224
+
225
+ # Safe Place
226
+ # How safe is Barcelona? (based a geo location and a radius)
227
+ amadeus.safety.safety_rated_locations.get(latitude: 41.397158, longitude: 2.160873)
228
+ # How safe is Barcelona? (based on a square)
229
+ amadeus.safety.safety_rated_locations.by_square.get(north: 41.397158, west: 2.160873, south: 41.394582, east: 2.177181)
230
+ # What is the safety information of a location based on it's Id?
231
+ amadeus.safety.safety_rated_location('Q930402753').get()
244
232
 
245
233
  # Airport On-Time Performance
246
234
  amadeus.airport.predictions.on_time.get(airportCode: 'JFK', date: '2020-08-01')
@@ -15,6 +15,7 @@ require 'amadeus/namespaces/reference_data'
15
15
  require 'amadeus/namespaces/e_reputation'
16
16
  require 'amadeus/namespaces/booking'
17
17
  require 'amadeus/namespaces/airport'
18
+ require 'amadeus/namespaces/safety'
18
19
  require 'amadeus/namespaces/airport/predictions'
19
20
  require 'amadeus/namespaces/airport/predictions/on_time'
20
21
  require 'amadeus/namespaces/e_reputation/hotel_sentiments'
@@ -25,8 +26,12 @@ require 'amadeus/namespaces/reference_data/urls/checkin_links'
25
26
  require 'amadeus/namespaces/reference_data/location'
26
27
  require 'amadeus/namespaces/reference_data/locations'
27
28
  require 'amadeus/namespaces/reference_data/locations/airports'
29
+ require 'amadeus/namespaces/reference_data/locations/point_of_interest'
28
30
  require 'amadeus/namespaces/reference_data/locations/points_of_interest'
29
31
  require 'amadeus/namespaces/reference_data/locations/points_of_interest/by_square'
32
+ require 'amadeus/namespaces/safety/safety_rated_location'
33
+ require 'amadeus/namespaces/safety/safety_rated_locations'
34
+ require 'amadeus/namespaces/safety/safety_rated_locations/by_square'
30
35
  require 'amadeus/namespaces/shopping/flight_destinations'
31
36
  require 'amadeus/namespaces/shopping/flight_offers_search'
32
37
  require 'amadeus/namespaces/shopping/flight_offers_search/prediction'
@@ -77,5 +77,15 @@ module Amadeus
77
77
  def airport
78
78
  Airport.new(self)
79
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
80
90
  end
81
91
  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 Point Of Interest API:
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,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
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amadeus
4
+ module Namespaces
5
+ # A namespaced client for the
6
+ # +/v1/safety+ endpoints
7
+ #
8
+ # Access via the +Amadeus::Client+ object
9
+ #
10
+ # amadeus = Amadeus::Client.new
11
+ # amadeus.safety
12
+ #
13
+ class Safety < Amadeus::Client::Decorator
14
+ # The namespace for the Safety APIs:
15
+ #
16
+ # @return [Amadeus::Namespaces::Safety::SafetyRetedLocations]
17
+ # @example
18
+ # amadeus.safety.safety_rated_locations
19
+ #
20
+ def safety_rated_locations
21
+ Amadeus::Namespaces::Safety::SafetyRatedLocations.new(client)
22
+ end
23
+
24
+ #
25
+ # @return [Amadeus::Namespaces::Safety::SafetyRetedLocation]
26
+ # @example
27
+ # amadeus.safety.safety_rated_location
28
+ #
29
+ def safety_rated_location(location_id)
30
+ Amadeus::Namespaces::Safety::SafetyRatedLocation.new(client, location_id)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -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,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Amadeus
4
+ module Namespaces
5
+ class Safety
6
+ # A namespaced client for the
7
+ # +/v1/safety/safety_rated_locations/+ endpoints
8
+ #
9
+ # Access via the +Amadeus::Client+ object
10
+ #
11
+ # amadeus = Amadeus::Client.new
12
+ # amadeus.safety.safety_rated_locations
13
+ #
14
+ class SafetyRatedLocations < Amadeus::Client::Decorator
15
+ # The namespace for the Safe Place API:
16
+ #
17
+ # @return [Amadeus::Namespaces::Safety::SafetyRatedLocations]
18
+ # @example
19
+ # amadeus.safety.safety_rated_locations.by_square
20
+ #
21
+ def by_square
22
+ Amadeus::Namespaces::Safety::SafetyRatedLocations::BySquare.new(client)
23
+ end
24
+
25
+ # Returns a list of relevant safety information near to a given point.
26
+ #
27
+ # @option params [Double] :latitude latitude location to be at the
28
+ # center of the search circle - required
29
+ # @option params [Double] :longitude longitude location to be at the
30
+ # center of the search circle - required
31
+ # @return [Amadeus::Response] a parsed response
32
+ # @raise [Amadeus::Base] an exception if the call
33
+ # failed
34
+ # @example What are the different safety information in Barcelona
35
+ # amadeus.safety.safety_rated_locations.get(
36
+ # latitude: 41.397158,
37
+ # longitude: 2.160873
38
+ # )
39
+ #
40
+ def get(params = {})
41
+ client.get('/v1/safety/safety-rated-locations', params)
42
+ end
43
+ end
44
+ end
45
+ end
46
+ 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
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Amadeus
4
4
  # The current client version
5
- VERSION = '5.0.0'
5
+ VERSION = '5.1.0'
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: 5.0.0
4
+ version: 5.1.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-05-14 00:00:00.000000000 Z
13
+ date: 2020-11-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: awesome_print
@@ -237,10 +237,15 @@ files:
237
237
  - lib/amadeus/namespaces/reference_data/location.rb
238
238
  - lib/amadeus/namespaces/reference_data/locations.rb
239
239
  - lib/amadeus/namespaces/reference_data/locations/airports.rb
240
+ - lib/amadeus/namespaces/reference_data/locations/point_of_interest.rb
240
241
  - lib/amadeus/namespaces/reference_data/locations/points_of_interest.rb
241
242
  - lib/amadeus/namespaces/reference_data/locations/points_of_interest/by_square.rb
242
243
  - lib/amadeus/namespaces/reference_data/urls.rb
243
244
  - lib/amadeus/namespaces/reference_data/urls/checkin_links.rb
245
+ - lib/amadeus/namespaces/safety.rb
246
+ - lib/amadeus/namespaces/safety/safety_rated_location.rb
247
+ - lib/amadeus/namespaces/safety/safety_rated_locations.rb
248
+ - lib/amadeus/namespaces/safety/safety_rated_locations/by_square.rb
244
249
  - lib/amadeus/namespaces/shopping.rb
245
250
  - lib/amadeus/namespaces/shopping/flight_dates.rb
246
251
  - lib/amadeus/namespaces/shopping/flight_destinations.rb
@@ -278,8 +283,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
278
283
  - !ruby/object:Gem::Version
279
284
  version: '0'
280
285
  requirements: []
281
- rubyforge_project:
282
- rubygems_version: 2.7.7
286
+ rubygems_version: 3.0.8
283
287
  signing_key:
284
288
  specification_version: 4
285
289
  summary: Amadeus travel APIs