Skip to content

Commit bbb4fe1

Browse files
authored
Adding support for POI API's retrieve endpoint
Adding support for POI API's retrieve endpoint
2 parents f22c3f4 + cb76102 commit bbb4fe1

File tree

5 files changed

+60
-8
lines changed

5 files changed

+60
-8
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ amadeus.shopping.flightOffersSearch.get({
205205

206206

207207
// Flight Create Orders
208-
// To book the flight-offer(s) suggested by flightOffersSearch API
208+
// To book the flight-offer(s) suggested by flightOffersSearch API
209209
// and create a flight-order with travelers' information
210210
amadeus.shopping.flightOffersSearch.get({
211211
originLocationCode: 'SYD',
@@ -248,7 +248,7 @@ amadeus.shopping.flightOffersSearch.get({
248248
});
249249

250250
// Flight SeatMap Display
251-
// To retrieve the seat map of each flight included
251+
// To retrieve the seat map of each flight included
252252
// in flight offers for MAD-NYC flight on 2020-08-01
253253
amadeus.shopping.flightOffersSearch.get({
254254
originLocationCode: 'SYD',
@@ -341,11 +341,11 @@ amadeus.shopping.hotelOffersByHotel.get({
341341
// Confirm the availability of a specific offer id
342342
amadeus.shopping.hotelOffer('XXX').get()
343343

344-
// Retrieve flight order with ID 'XXX'. This ID comes from the
344+
// Retrieve flight order with ID 'XXX'. This ID comes from the
345345
// Flight Create Orders API, which is a temporary ID in test environment.
346346
amadeus.booking.flightOrder('XXX').get()
347347

348-
// Cancel flight order with ID 'XXX'. This ID comes from the
348+
// Cancel flight order with ID 'XXX'. This ID comes from the
349349
// Flight Create Orders API, which is a temporary ID in test environment.
350350
amadeus.booking.flightOrder('XXX').delete()
351351

@@ -374,6 +374,10 @@ amadeus.referenceData.locations.pointsOfInterest.bySquare.get({
374374
east: 2.177181
375375
})
376376

377+
// Points of Interest
378+
// Extract the information about point of interest with ID '9CB40CB5D0'
379+
amadeus.referenceData.locations.pointOfInterest('9CB40CB5D0').get()
380+
377381
// Hotel Ratings
378382
// Get Sentiment Analysis of reviews about Holiday Inn Paris Notre Dame.
379383
amadeus.eReputation.hotelSentiments.get({
@@ -396,7 +400,7 @@ amadeus.media.files.generatedPhotos.get({
396400
})
397401

398402
// Flight Delay Prediction
399-
// This machine learning API is based on a prediction model that takes the input of the user - time, carrier, airport and aircraft information;
403+
// This machine learning API is based on a prediction model that takes the input of the user - time, carrier, airport and aircraft information;
400404
// and predict the segment where the flight is likely to lay.
401405
amadeus.travel.predictions.flightDelay.get({
402406
originLocationCode: 'BRU',

spec/amadeus/namespaces.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ describe('Namespaces', () => {
2222
expect(amadeus.referenceData.location).toBeDefined();
2323
expect(amadeus.referenceData.locations).toBeDefined();
2424
expect(amadeus.referenceData.locations.airports).toBeDefined();
25+
expect(amadeus.referenceData.locations.pointOfInterest).toBeDefined();
2526
expect(amadeus.referenceData.locations.pointsOfInterest).toBeDefined();
2627
expect(amadeus.referenceData.locations.pointsOfInterest.bySquare).toBeDefined();
2728
expect(amadeus.referenceData.airlines).toBeDefined();
@@ -74,6 +75,7 @@ describe('Namespaces', () => {
7475
expect(amadeus.referenceData.location('ALHR').get).toBeDefined();
7576
expect(amadeus.referenceData.locations.get).toBeDefined();
7677
expect(amadeus.referenceData.locations.airports.get).toBeDefined();
78+
expect(amadeus.referenceData.locations.pointOfInterest('XXX').get).toBeDefined();
7779
expect(amadeus.referenceData.locations.pointsOfInterest.get).toBeDefined();
7880
expect(amadeus.referenceData.locations.pointsOfInterest.bySquare.get).toBeDefined();
7981
expect(amadeus.referenceData.airlines.get).toBeDefined();
@@ -152,6 +154,13 @@ describe('Namespaces', () => {
152154
.toHaveBeenCalledWith('/v1/reference-data/locations/pois', {});
153155
});
154156

157+
it('.amadeus.referenceData.locations.pointOfInterest("XXX").get', () => {
158+
amadeus.client.get = jest.fn();
159+
amadeus.referenceData.locations.pointOfInterest('XXX').get();
160+
expect(amadeus.client.get)
161+
.toHaveBeenCalledWith('/v1/reference-data/locations/pois/XXX');
162+
});
163+
155164
it('.amadeus.referenceData.locations.pointsOfInterest.bySquare.get', () => {
156165
amadeus.client.get = jest.fn();
157166
amadeus.referenceData.locations.pointsOfInterest.bySquare.get();

src/amadeus/namespaces/reference_data/locations.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Airports from './locations/airports';
2+
import PointOfInterest from './locations/poi';
23
import PointsOfInterest from './locations/pois';
34

45
/**
@@ -43,6 +44,11 @@ class Locations {
4344
get(params = {}) {
4445
return this.client.get('/v1/reference-data/locations', params);
4546
}
47+
48+
pointOfInterest(poiId) {
49+
return new PointOfInterest(this.client, poiId);
50+
}
51+
4652
}
4753

4854
export default Locations;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* A namespaced client for the
3+
* `/v1/reference-data/locations/pois` endpoints
4+
*
5+
* Access via the {@link Amadeus} object
6+
*
7+
* ```js
8+
* let amadeus = new Amadeus();
9+
* amadeus.referenceData.locations.pointOfInterest;
10+
* ```
11+
*
12+
* @param {Client} client
13+
*/
14+
class PointOfInterest {
15+
constructor(client, poiId) {
16+
this.client = client;
17+
this._poiId = poiId;
18+
}
19+
20+
/**
21+
* Extracts the information about point of interest with given ID
22+
*
23+
* Extract the information about point of interest with ID '9CB40CB5D0'
24+
* ```js
25+
* amadeus.referenceData.locations.pointOfInterest('9CB40CB5D0').get();
26+
* ```
27+
*/
28+
get() {
29+
return this.client.get(`/v1/reference-data/locations/pois/${this._poiId}`);
30+
}
31+
}
32+
33+
export default PointOfInterest;

src/amadeus/namespaces/reference_data/locations/pois.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import BySquare from './points_of_interest/by-square';
1313
*
1414
* @param {Client} client
1515
*/
16-
class pointsOfInterest {
16+
class PointsOfInterest {
1717
constructor(client) {
1818
this.client = client;
1919
this.bySquare = new BySquare(client);
2020
}
2121

2222
/**
23-
* Returns a list of relevant points of interest near to a given point.
23+
* Returns a list of relevant points of interest near to a given point
2424
*
2525
* @param {Object} params
2626
* @param {Double} params.latitude latitude location to be at the center of
@@ -44,4 +44,4 @@ class pointsOfInterest {
4444
}
4545
}
4646

47-
export default pointsOfInterest;
47+
export default PointsOfInterest;

0 commit comments

Comments
 (0)