diff --git a/README.md b/README.md index c3102e7..fea7aa6 100644 --- a/README.md +++ b/README.md @@ -342,29 +342,6 @@ amadeus.travel.analytics.airTraffic.busiestPeriod.get({ direction: Amadeus.direction.arriving }) -// Trip Parser API V3 -// parse information from flight, hotel, rail, and rental car confirmation emails -// Parse directly from your confirmation file by using helper `fromFile` -amadeus.travel.tripParser.post( - JSON.stringify({ - 'payload': amadeus.travel.tripParser.fromFile(fs.readFileSync('confirmation.eml')), - "metadata": { - "documentType": "eml", - "name": "BOOKING_DOCUMENT", - "encoding": "BASE_64" - } -})) -// Alternatively Parse from a string encoded in BASE_64 -amadeus.travel.tripParser.post( - JSON.stringify({ - 'payload': "STRING in BASE_64" - "metadata": { - "documentType": "html", - "name": "BOOKING_DOCUMENT", - "encoding": "BASE_64" - } -})) - // City Search API // finds cities that match a specific word or string of letters. // Return a list of cities matching a keyword 'Paris' diff --git a/spec/amadeus/namespaces.test.js b/spec/amadeus/namespaces.test.js index b8d794c..f579498 100644 --- a/spec/amadeus/namespaces.test.js +++ b/spec/amadeus/namespaces.test.js @@ -48,7 +48,6 @@ describe('Namespaces', () => { expect(amadeus.travel.predictions).toBeDefined(); expect(amadeus.travel.predictions.tripPurpose).toBeDefined(); expect(amadeus.travel.predictions.flightDelay).toBeDefined(); - expect(amadeus.travel.tripParser).toBeDefined(); expect(amadeus.shopping).toBeDefined(); expect(amadeus.shopping.flightDates).toBeDefined(); @@ -152,7 +151,6 @@ describe('Namespaces', () => { expect(amadeus.shopping.flightOffers.prediction.post).toBeDefined(); expect(amadeus.booking.flightOrders.post).toBeDefined(); expect(amadeus.shopping.flightOffersSearch.post).toBeDefined(); - expect(amadeus.travel.tripParser.post).toBeDefined(); expect(amadeus.shopping.flightOffers.pricing.post).toBeDefined(); expect(amadeus.shopping.seatmaps.post).toBeDefined(); expect(amadeus.booking.hotelBookings.post).toBeDefined(); @@ -306,19 +304,6 @@ describe('Namespaces', () => { .toHaveBeenCalledWith('/v1/travel/analytics/air-traffic/busiest-period', {}); }); - it('.amadeus.travel.tripParser.post', () => { - amadeus.client.post = jest.fn(); - amadeus.travel.tripParser.post(); - expect(amadeus.client.post) - .toHaveBeenCalledWith('/v3/travel/trip-parser', {}); - }); - - it('.amadeus.travel.tripParser.fromFile', () => { - const utf8Buffer = Buffer.from('file contént', 'utf8'); - const base64Encoding = amadeus.travel.tripParser.fromFile(utf8Buffer); - expect(base64Encoding).toEqual('ZmlsZSBjb250w6ludA=='); - }); - it('.amadeus.shopping.flightDates.get', () => { amadeus.client.get = jest.fn(); amadeus.shopping.flightDates.get(); diff --git a/src/amadeus/namespaces/travel.js b/src/amadeus/namespaces/travel.js index 261c6bd..59bde59 100644 --- a/src/amadeus/namespaces/travel.js +++ b/src/amadeus/namespaces/travel.js @@ -1,6 +1,5 @@ import Analytics from './travel/analytics'; import Predictions from './travel/predictions'; -import TripParser from './travel/trip_parser'; /** * A namespaced client for the @@ -16,7 +15,6 @@ import TripParser from './travel/trip_parser'; * @param {Client} client * @property {Analytics} analytics * @property {Predictions} predictions - * @property {TripParser} tripParser * @protected */ class Travel { @@ -24,7 +22,6 @@ class Travel { this.client = client; this.analytics = new Analytics(client); this.predictions = new Predictions(client); - this.tripParser = new TripParser(client); } } diff --git a/src/amadeus/namespaces/travel/trip_parser.js b/src/amadeus/namespaces/travel/trip_parser.js deleted file mode 100644 index 382a8a1..0000000 --- a/src/amadeus/namespaces/travel/trip_parser.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * A namespaced client for the - * `/v3/travel/trip-parser` endpoints - * - * Access via the {@link Amadeus} object - * - * ```js - * let amadeus = new Amadeus(); - * amadeus.tripParser; - * ``` - * - * @param {Client} client - */ -class TripParser { - constructor(client) { - this.client = client; - } - - /** - * parse information from flight, hotel, rail, and rental car confirmation emails - * - * @param {Object} params - * @return {Promise.} a Promise - * - * "How can I show travelers their full itinerary in one place?" - * - * ```js - * amadeus.tripParser.post(body); - * ``` - */ - post(params = {}) { - return this.client.post('/v3/travel/trip-parser', params); - } - /** - * Helper method to convert file contents in UTF-8 encoded string - * into Base64 encoded string - */ - fromFile(fileContentsInUTF8Format) { - return (new Buffer.from(fileContentsInUTF8Format)).toString('base64'); - } -} - -export default TripParser;