diff --git a/README.md b/README.md index ad24b3b..58e98b4 100644 --- a/README.md +++ b/README.md @@ -448,24 +448,6 @@ amadeus.location.analytics.categoryRatedAreas.get({ longitude : 2.160873 }) -// Safe Place -// How safe is Barcelona? (based a geo location and a radius) -amadeus.safety.safetyRatedLocations.get({ - latitude: 41.397158, - longitude: 2.160873 -}) - -// How safe is Barcelona? (based on a square) -amadeus.safety.safetyRatedLocations.bySquare.get({ - north: 41.397158, - west: 2.160873, - south: 41.394582, - east: 2.177181 -}) - -// What is the safety information of a location based on its Id? -amadeus.safety.safetyRatedLocation('Q930400801').get() - // Tours and Activities // What are the best tours and activities in Barcelona? amadeus.shopping.activities.get({ diff --git a/spec/amadeus/namespaces.test.js b/spec/amadeus/namespaces.test.js index bf04dad..4e94dce 100644 --- a/spec/amadeus/namespaces.test.js +++ b/spec/amadeus/namespaces.test.js @@ -92,11 +92,6 @@ describe('Namespaces', () => { expect(amadeus.airport.predictions).toBeDefined(); expect(amadeus.airport.predictions.onTime).toBeDefined(); - expect(amadeus.safety).toBeDefined(); - expect(amadeus.safety.safetyRatedLocations).toBeDefined(); - expect(amadeus.safety.safetyRatedLocations.bySquare).toBeDefined(); - expect(amadeus.safety.safetyRatedLocation).toBeDefined(); - expect(amadeus.location).toBeDefined(); expect(amadeus.location.analytics).toBeDefined(); expect(amadeus.location.analytics.categoryRatedAreas).toBeDefined(); @@ -148,10 +143,6 @@ describe('Namespaces', () => { expect(amadeus.airport.predictions.onTime.get).toBeDefined(); - expect(amadeus.safety.safetyRatedLocations.get).toBeDefined(); - expect(amadeus.safety.safetyRatedLocations.bySquare.get).toBeDefined(); - expect(amadeus.safety.safetyRatedLocation('XXX').get).toBeDefined(); - expect(amadeus.location.analytics.categoryRatedAreas.get).toBeDefined(); expect(amadeus.airline.destinations.get).toBeDefined(); @@ -491,27 +482,6 @@ describe('Namespaces', () => { .toHaveBeenCalledWith('/v1/airport/predictions/on-time', {}); }); - it('.amadeus.safety.safetyRatedLocations.get', () => { - amadeus.client.get = jest.fn(); - amadeus.safety.safetyRatedLocations.get(); - expect(amadeus.client.get) - .toHaveBeenCalledWith('/v1/safety/safety-rated-locations', {}); - }); - - it('.amadeus.safety.safetyRatedLocations.bySquare.get', () => { - amadeus.client.get = jest.fn(); - amadeus.safety.safetyRatedLocations.bySquare.get(); - expect(amadeus.client.get) - .toHaveBeenCalledWith('/v1/safety/safety-rated-locations/by-square', {}); - }); - - it('.amadeus.safety.safetyRatedLocation().get', () => { - amadeus.client.get = jest.fn(); - amadeus.safety.safetyRatedLocation('XXX').get(); - expect(amadeus.client.get) - .toHaveBeenCalledWith('/v1/safety/safety-rated-locations/XXX'); - }); - it('.amadeus.shopping.availability.flightAvailabilities.post', () => { amadeus.client.post = jest.fn(); amadeus.shopping.availability.flightAvailabilities.post(); diff --git a/src/amadeus.js b/src/amadeus.js index 71d2f29..ed5ebda 100644 --- a/src/amadeus.js +++ b/src/amadeus.js @@ -9,7 +9,6 @@ import EReputation from './amadeus/namespaces/e_reputation'; import Media from './amadeus/namespaces/media'; import Ordering from './amadeus/namespaces/ordering'; import Airport from './amadeus/namespaces/airport'; -import Safety from './amadeus/namespaces/safety'; import Schedule from './amadeus/namespaces/schedule'; import Analytics from './amadeus/namespaces/analytics'; import Location from './amadeus/namespaces/location'; @@ -75,7 +74,6 @@ class Amadeus { this.ordering = new Ordering(this.client); this.airport = new Airport(this.client); this.pagination = new Pagination(this.client); - this.safety = new Safety(this.client); this.schedule = new Schedule(this.client); this.analytics = new Analytics(this.client); this.location = new Location(this.client); diff --git a/src/amadeus/namespaces/safety.js b/src/amadeus/namespaces/safety.js deleted file mode 100644 index 2e10e02..0000000 --- a/src/amadeus/namespaces/safety.js +++ /dev/null @@ -1,29 +0,0 @@ -import SafetyRatedLocations from './safety/safety_rated_locations'; -import SafetyRatedLocation from './safety/safety_rated_location'; - -/** - * A namespaced client for the - * `/v1/safety` endpoints - * - * Access via the {@link Amadeus} object - * - * ```js - * let amadeus = new Amadeus(); - * amadeus.safety; - * ``` - * - * @param {Client} client - * @property {SafetyRatedLocations} safetyRatedLocations - */ -class Safety { - constructor(client) { - this.client = client; - this.safetyRatedLocations = new SafetyRatedLocations(client); - } - - safetyRatedLocation(locationId) { - return new SafetyRatedLocation(this.client, locationId); - } -} - -export default Safety; \ No newline at end of file diff --git a/src/amadeus/namespaces/safety/safety_rated_location.js b/src/amadeus/namespaces/safety/safety_rated_location.js deleted file mode 100644 index 6b801e8..0000000 --- a/src/amadeus/namespaces/safety/safety_rated_location.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * A namespaced client for the - * `/v1/safety/safety-rated-locations` endpoints - * - * Access via the {@link Amadeus} object - * - * ```js - * let amadeus = new Amadeus(); - * amadeus.safety.safetyRatedLocation; - * ``` - * - * @param {Client} client - */ -class SafetyRatedLocation { - constructor(client, locationId) { - this.client = client; - this.locationId = locationId; - } - - /** - * Retieve safety information of a location by its Id. - * - * What is the safety information of a location with Id Q930400801? - * ```js - * amadeus.safety.safetyRatedLocation('Q930400801').get(); - * ``` - */ - get() { - return this.client.get(`/v1/safety/safety-rated-locations/${this.locationId}`); - } -} - -export default SafetyRatedLocation; diff --git a/src/amadeus/namespaces/safety/safety_rated_locations.js b/src/amadeus/namespaces/safety/safety_rated_locations.js deleted file mode 100644 index f174d6c..0000000 --- a/src/amadeus/namespaces/safety/safety_rated_locations.js +++ /dev/null @@ -1,47 +0,0 @@ -import BySquare from './safety_rated_locations/by_square'; - -/** - * A namespaced client for the - * `/v1/safety/safety-rated-locations` endpoints - * - * Access via the {@link Amadeus} object - * - * ```js - * let amadeus = new Amadeus(); - * amadeus.safety.safetyRatedLocations; - * ``` - * - * @param {Client} client - */ -class SafetyRatedLocations { - constructor(client) { - this.client = client; - this.bySquare = new BySquare(client); - } - - /** - * /safety/safety-rated-locations - * - * @param {Object} params - * @param {Double} params.latitude latitude location to be at the center of - * the search circle - required - * @param {Double} params.longitude longitude location to be at the center of - * the search circle - required - * @param {Double} params.radius radius of the search in Kilometer - optional - * @return {Promise.} a Promise - * - * How safe is Barcelona? (based a geo location and a radius) - * - * ```js - * amadeus.safety.safetyRatedLocations.get({ - * longitude: 2.160873, - * latitude: 41.397158 - * }); - * ``` - */ - get(params = {}) { - return this.client.get('/v1/safety/safety-rated-locations', params); - } -} - -export default SafetyRatedLocations; diff --git a/src/amadeus/namespaces/safety/safety_rated_locations/by_square.js b/src/amadeus/namespaces/safety/safety_rated_locations/by_square.js deleted file mode 100644 index 4a5d35b..0000000 --- a/src/amadeus/namespaces/safety/safety_rated_locations/by_square.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * A namespaced client for the - * `/v1/safety/safety-rated-locations/by-square` endpoints - * - * Access via the {@link Amadeus} object - * - * ```js - * let amadeus = new Amadeus(); - * amadeus.safety.safetyRatedLocations.bySquare; - * ``` - * - * @param {Client} client - */ -class bySquare { - constructor(client) { - this.client = client; - } - - /** - * Returns the safety rating of a given area - * - * @param {Object} params - * @param {Double} params.north latitude north of bounding box - required - * @param {Double} params.west longitude west of bounding box - required - * @param {Double} params.south latitude south of bounding box - required - * @param {Double} params.east longitude east of bounding box - required - * @return {Promise.} a Promise - * - * How safe is Barcelona? (based on a square) - * - * ```js - * amadeus.safety.safetyRatedLocations.bySquare.get({ - * north: 41.397158, - * west: 2.160873, - * south: 41.394582, - * east: 2.177181 - * }); - * ``` - */ - get(params = {}) { - return this.client.get('/v1/safety/safety-rated-locations/by-square', params); - } -} - -export default bySquare;