Skip to content

Commit 634f708

Browse files
committed
add Airport Route
1 parent f919a89 commit 634f708

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

spec/amadeus/namespaces.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ describe('Namespaces', () => {
7979
expect(amadeus.media.files).toBeDefined();
8080

8181
expect(amadeus.airport).toBeDefined();
82+
expect(amadeus.airport.directDestinations).toBeDefined();
8283
expect(amadeus.airport.predictions).toBeDefined();
8384
expect(amadeus.airport.predictions.onTime).toBeDefined();
8485

@@ -429,6 +430,13 @@ describe('Namespaces', () => {
429430
.toHaveBeenCalledWith('/v1/travel/predictions/flight-delay', {});
430431
});
431432

433+
it('.amadeus.airport.directDestinations.get', () => {
434+
amadeus.client.get = jest.fn();
435+
amadeus.airport.directDestinations.get();
436+
expect(amadeus.client.get)
437+
.toHaveBeenCalledWith('/v1/airport/direct-destinations', {});
438+
});
439+
432440
it('.amadeus.airport.predictions.onTime.get', () => {
433441
amadeus.client.get = jest.fn();
434442
amadeus.airport.predictions.onTime.get();

src/amadeus/namespaces/airport.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import DirectDestinations from './airport/direct-destinations';
12
import Predictions from './airport/predictions';
23

34
/**
@@ -17,6 +18,7 @@ import Predictions from './airport/predictions';
1718
class Airport {
1819
constructor(client) {
1920
this.client = client;
21+
this.directDestinations = new DirectDestinations(client);
2022
this.predictions = new Predictions(client);
2123
}
2224
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* A namespaced client for the
3+
* `/v1/airport/direct-destinations` endpoints
4+
*
5+
* Access via the {@link Amadeus} object
6+
*
7+
* ```js
8+
* let amadeus = new Amadeus();
9+
* amadeus.airport.directDestinations;
10+
* ```
11+
*
12+
* @param {Client} client
13+
*/
14+
class DirectDestinations {
15+
constructor(client) {
16+
this.client = client;
17+
}
18+
19+
/**
20+
* Get the percentage of on-time flight departures from a given airport
21+
*
22+
* @param {Object} params
23+
* @param {string} params.departureAirportCode airport IATA code, e.g. BOS for Boston
24+
* @return {Promise.<Response,ResponseError>} a Promise
25+
*
26+
* What destinations are served by this airport?
27+
* ```js
28+
* amadeus.airport.directDestinations.get({
29+
* departureAirportCode: 'JFK',
30+
* })
31+
* ```
32+
*/
33+
get(params = {}) {
34+
return this.client.get('/v1/airport/direct-destinations', params);
35+
}
36+
}
37+
38+
export default DirectDestinations;

0 commit comments

Comments
 (0)