-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Tours and Activities API
- Loading branch information
Showing
6 changed files
with
213 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import BySquare from './activities/by_square'; | ||
|
||
/** | ||
* A namespaced client for the | ||
* `/v1/shopping/activities` endpoints | ||
* | ||
* Access via the {@link Amadeus} object | ||
* | ||
* ```js | ||
* let amadeus = new Amadeus(); | ||
* amadeus.shopping.activities | ||
* ``` | ||
* | ||
* @param {Client} client | ||
*/ | ||
class Activities { | ||
constructor(client) { | ||
this.client = client; | ||
this.bySquare = new BySquare(client); | ||
} | ||
|
||
/** | ||
* /shopping/activities | ||
* | ||
* @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.<Response,ResponseError>} a Promise | ||
* | ||
* What are the best tours and activities in Barcelona? (based a geo location and a radius) | ||
* | ||
* ```js | ||
* amadeus.shopping.activities.get({ | ||
* longitude: 2.160873, | ||
* latitude: 41.397158 | ||
* }); | ||
* ``` | ||
*/ | ||
get(params = {}) { | ||
return this.client.get('/v1/shopping/activities', params); | ||
} | ||
} | ||
|
||
export default Activities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* A namespaced client for the | ||
* `/v1/shopping/activities/by-square` endpoints | ||
* | ||
* Access via the {@link Amadeus} object | ||
* | ||
* ```js | ||
* let amadeus = new Amadeus(); | ||
* amadeus.shopping.activities.bySquare; | ||
* ``` | ||
* | ||
* @param {Client} client | ||
*/ | ||
class bySquare { | ||
constructor(client) { | ||
this.client = client; | ||
} | ||
|
||
/** | ||
* Returns a list of tours and activities 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.<Response,ResponseError>} a Promise | ||
* | ||
* Find relevant tours and activities within an area in Barcelona | ||
* | ||
* ```js | ||
* amadeus.shopping.activities.bySquare.get({ | ||
* north: 41.397158, | ||
* west: 2.160873, | ||
* south: 41.394582, | ||
* east: 2.177181 | ||
* }); | ||
* ``` | ||
*/ | ||
get(params = {}) { | ||
return this.client.get('/v1/shopping/activities/by-square', params); | ||
} | ||
} | ||
|
||
export default bySquare; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* A namespaced client for the | ||
* `/v1/shopping/activities/{activityId}` endpoints | ||
* | ||
* Access via the {@link Amadeus} object | ||
* | ||
* ```js | ||
* let amadeus = new Amadeus(); | ||
* amadeus.shopping.activity | ||
* ``` | ||
* | ||
* @param {Client} client | ||
*/ | ||
class Activity { | ||
constructor(client, activityId) { | ||
this.client = client; | ||
this.activityId = activityId; | ||
} | ||
|
||
/** | ||
* Retieve information of an activity by its Id. | ||
* | ||
* What is the activity information with Id 3216547684? | ||
* ```js | ||
* amadeus.shopping.activity('3216547684').get(); | ||
* ``` | ||
*/ | ||
get() { | ||
return this.client.get(`/v1/shopping/activities/${this.activityId}`); | ||
} | ||
} | ||
|
||
export default Activity; |