Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ logs
results

npm-debug.log

node_modules/
test/
78 changes: 41 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,64 @@
[![NPM](https://nodei.co/npm/yfb-expedia.png)](https://nodei.co/npm/yfb-expedia/)
[![NPM](https://nodei.co/npm/node-expedia-api.png)](https://nodei.co/npm/node-expedia-api/)

This module is a fork of [expedia](https://www.npmjs.com/package/expedia) module that is not maintained anymore.

## Expedia API
# Expedia API

Small client interface for the [Expedia EAN api](http://developer.ean.com/). Provides an interface for the following methods:
- **Hotel List** Retrieve a list of hotels by location or a list of specific hotel ids
- **Hotel Information** Retrieve detailed information about a hotel from a hotel id
- **Room Availability** Retrieve all available rooms for a specific hotel that accommodate the provided guest count and any other criteria.
- **Room Images** Retrieve a list of room images for a specific hotelId organized by room type
- **Payment Types** Retrieve credit card types compatible with current request settings
- **Book Reservation** Request a reservation for the specified room(s).
- **Itinerary Request** Retrieve an existing itinerary's status and details, confirm the status of a previously requested booking, or retrieve a list of itineraries from a specified date span.
- **Cancel Reservation** Cancel an existing reservation for a single room.
- **Ping Request** Send a ping request to expedia API servers to determine if service is available in the event of a suspected outage or ISP issue, or to obtain EAN's Unix server time when troubleshooting issues with signature authentication.
- **Geo Functions** Obtain location data such as a specific destinationId, latitude/longitude coordinates, and the number of active properties available within the location.
Small client interface for the [Expedia EAN api](http://developer.ean.com/).<br>
Provides an interface for the following methods:

## Installation
- **Hotel List** Retrieve a list of hotels by location or a list of specific hotel ids
- **Hotel Information** Retrieve detailed information about a hotel from a hotel id
- **Room Availability** Retrieve all available rooms for a specific hotel that accommodate the provided guest count and any other criteria.
- **Room Images** Retrieve a list of room images for a specific hotelId organized by room type
- **Payment Types** Retrieve credit card types compatible with current request settings
- **Book Reservation** Request a reservation for the specified room(s).
- **Itinerary Request** Retrieve an existing itinerary's status and details, confirm the status of a previously requested booking, or retrieve a list of itineraries from a specified date span.
- **Cancel Reservation** Cancel an existing reservation for a single room.
- **Ping Request** Send a ping request to expedia API servers to determine if service is available in the event of a suspected outage or ISP issue, or to obtain EAN's Unix server time when troubleshooting issues with signature authentication.
- **Geo Functions** Obtain location data such as a specific destinationId, latitude/longitude coordinates, and the number of active properties available within the location.

Install with npm:
```npm install yfb-expedia```
# Installation

## Initialization
Install with npm:

Usage requires an Expedia Api key and CID. For development use you can use the CID 55505. You can obtain your api key from the [Expedia EAN api documentation](http://developer.ean.com/).
```
npm install --save node-expedia-api
```

# Initialization

Usage requires an Expedia Api key and CID. For development use you can use the CID 55505\. You can obtain your api key from the [Expedia EAN api documentation](http://developer.ean.com/).

```javascript
var options = {
cid : "YOUR CID",
apiKey : "YOUR EAN API KEY",
locale : "en_US", // optional defaults to en_US
currencyCode :"USD" // optional defaults to USD
var options = {
cid: 'YOUR CID',
apiKey: 'YOUR EAN API KEY',
secret: 'YOUR SECRET',
locale: 'en_US', // optional defaults to en_US
currencyCode: 'USD' // optional defaults to USD
};

var expedia = require("expedia")(options, sendAsREST);
var expedia = require("expedia")(options);
```
sendAsREST parameter allows you to choose if you want to send your data in XML or REST format (forgetting the param sets format to XML).
Note that usage of XML is going to be deprecated by Expedia.

## Usage
# Usage

Expedia requires that you pass in a customer ip, unique session identifier, and browser agent. The remaining parameters are defined in the [Expedia EAN api documentation](http://developer.ean.com/). Please see the example directory for more options.
Expedia requires that you pass in a customer ip, unique session identifier, and browser agent. The remaining parameters are defined in the [Expedia EAN api documentation](http://developer.ean.com/). Please see the example directory for more options.

```javascript
var options = {
"customerSessionId" : "thisisauniqueID",
"customerIpAddress" : "127.0.0.1",
"customerUserAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"LocationInfoRequest": {
"locale": "en_US",
"destinationString": "Seattle, WA"
}
customerSessionId: 'thisisauniqueID',
customerIpAddress: '127.0.0.1',
customerUserAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)',
city: 'Bellevue',
stateProvinceCode: 'WA',
countryCode: 'US',
postalCode: '98004'
};

expedia.geoSearch(options, function(err, res){
if(err)throw new Error(err);
expedia.geoSearch(options, function(err, res) {
if (err) { throw new Error(err); }
console.log(res);
});
```
18 changes: 9 additions & 9 deletions examples/geo-search.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
var expedia = require("../lib/expedia")({apiKey:"cbrzfta369qwyrm9t5b8y8kf",cid:"55505"});
var expedia = require("../lib/expedia")({
apiKey: "cbrzfta369qwyrm9t5b8y8kf",
cid: "55505"
});

// Takes a search string as an argument, and returns location information available for performing a hotel search
// a complete list of options is available at http://developer.ean.com/docs/geo-functions/
var options = {
"customerSessionId" : "thisisauniqueID",
"customerIpAddress" : "127.0.0.1",
"customerUserAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"LocationInfoRequest": {
"customerSessionId": "thisisauniqueID",
"customerIpAddress": "127.0.0.1",
"customerUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"locale": "en_US",
"destinationString": "Seattle, WA"
}
};

expedia.geoSearch(options, function(err, res){
if(err)throw new Error(err);
expedia.geoSearch(options, function(err, res) {
if (err) throw new Error(err);
console.log(res);
});

20 changes: 10 additions & 10 deletions examples/hotel-accepted-payments.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
var expedia = require("../lib/expedia")({apiKey:"cbrzfta369qwyrm9t5b8y8kf",cid:"55505"});
var expedia = require("../lib/expedia")({
apiKey: "cbrzfta369qwyrm9t5b8y8kf",
cid: "55505"
});

// a complete list of options is available at http://developer.ean.com/docs/payment-types/
// a complete list of options is available at http://developer.ean.com/docs/payment-types/
var options = {
"customerSessionId" : "thisisauniqueID",
"customerIpAddress" : "127.0.0.1",
"customerUserAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"HotelPaymentRequest": {
"customerSessionId": "thisisauniqueID",
"customerIpAddress": "127.0.0.1",
"customerUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"hotelId": "122212",
"supplierType": "E",
"rateType": "MerchantStandard"
}
};

expedia.hotels.acceptedPayments(options, function(err, res){
if(err)throw new Error(err);
expedia.hotels.acceptedPayments(options, function(err, res) {
if (err) throw new Error(err);
console.log(res);
});

22 changes: 12 additions & 10 deletions examples/hotel-availability.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
var expedia = require("../lib/expedia")({apiKey:"cbrzfta369qwyrm9t5b8y8kf",cid:"55505"});
var expedia = require("../lib/expedia")({
apiKey: "cbrzfta369qwyrm9t5b8y8kf",
cid: "55505"
});

// a complete list of options is available at http://developer.ean.com/docs/room-avail/
var options = {
"customerSessionId" : "thisisauniqueID",
"customerIpAddress" : "127.0.0.1",
"customerUserAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"HotelRoomAvailabilityRequest": {
"customerSessionId": "thisisauniqueID",
"customerIpAddress": "127.0.0.1",
"customerUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"hotelId": "106347",
"arrivalDate": "9/30/2013",
"departureDate": "10/2/2013",
"includeDetails": "true",
"RoomGroup": {
"Room": { "numberOfAdults": "2" }
"Room": {
"numberOfAdults": "2"
}
}
}
};

expedia.hotels.availability(options, function(err, res){
if(err)throw new Error(err);
expedia.hotels.availability(options, function(err, res) {
if (err) throw new Error(err);
console.log(res);
});

18 changes: 9 additions & 9 deletions examples/hotel-info.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
var expedia = require("../lib/expedia")({apiKey:"cbrzfta369qwyrm9t5b8y8kf",cid:"55505"});
var expedia = require("../lib/expedia")({
apiKey: "cbrzfta369qwyrm9t5b8y8kf",
cid: "55505"
});

// a complete list of options is available at http://developer.ean.com/docs/hotel-info/
var options = {
"customerSessionId" : "thisisauniqueID",
"customerIpAddress" : "127.0.0.1",
"customerUserAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"HotelInformationRequest": {
"customerSessionId": "thisisauniqueID",
"customerIpAddress": "127.0.0.1",
"customerUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"hotelId": "122212",
"options": "0"
}
};

expedia.hotels.info(options, function(err, res){
if(err)throw new Error(err);
expedia.hotels.info(options, function(err, res) {
if (err) throw new Error(err);
console.log(res);
});

22 changes: 12 additions & 10 deletions examples/hotel-list.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
var expedia = require("../lib/expedia")({apiKey:"cbrzfta369qwyrm9t5b8y8kf",cid:"55505"});
var expedia = require("../lib/expedia")({
apiKey: "cbrzfta369qwyrm9t5b8y8kf",
cid: "55505"
});

// a complete list of options is available at http://developer.ean.com/docs/hotel-list/
var options = {
"customerSessionId" : "thisisauniqueID",
"customerIpAddress" : "127.0.0.1",
"customerUserAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"HotelListRequest": {
"customerSessionId": "thisisauniqueID",
"customerIpAddress": "127.0.0.1",
"customerUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"city": "Seattle",
"stateProvinceCode": "WA",
"countryCode": "US",
"arrivalDate": "9/30/2013",
"departureDate": "10/2/2013",
"RoomGroup": {
"Room": { "numberOfAdults": "2" }
"Room": {
"numberOfAdults": "2"
}
},
"numberOfResults": "25"
}
}

expedia.hotels.list(options, function(err, res){
if(err)throw new Error(err);
expedia.hotels.list(options, function(err, res) {
if (err) throw new Error(err);
console.log(res);
});

22 changes: 12 additions & 10 deletions examples/hotel-room-images.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
var expedia = require("../lib/expedia")({apiKey:"cbrzfta369qwyrm9t5b8y8kf",cid:"55505"});
var expedia = require("../lib/expedia")({
apiKey: "cbrzfta369qwyrm9t5b8y8kf",
cid: "55505"
});

// a complete list of options is available at http://developer.ean.com/docs/room-images/
var options = {
"customerSessionId" : "thisisauniqueID",
"customerIpAddress" : "127.0.0.1",
"customerUserAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"HotelRoomImagesRequest": {
"hotelId": "106347",
}
"customerSessionId": "thisisauniqueID",
"customerIpAddress": "127.0.0.1",
"customerUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"HotelRoomImagesRequest": {
"hotelId": "106347",
}
};

expedia.hotels.roomImages(options, function(err, res){
if(err)throw new Error(err);
expedia.hotels.roomImages(options, function(err, res) {
if (err) throw new Error(err);
console.log(res);
});

20 changes: 12 additions & 8 deletions examples/ping.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
var expedia = require("../lib/expedia")({apiKey:"cbrzfta369qwyrm9t5b8y8kf",cid:"55505"});
var expedia = require("../lib/expedia")({
apiKey: "cbrzfta369qwyrm9t5b8y8kf",
cid: "55505"
});

// Simple echo server, response should match input
var options = {
"customerSessionId" : "thisisauniqueID",
"customerIpAddress" : "127.0.0.1",
"customerUserAgent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"PingRequest": { "echo": "This message should be echoed back to you." }
"customerSessionId": "thisisauniqueID",
"customerIpAddress": "127.0.0.1",
"customerUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko)",
"PingRequest": {
"echo": "This message should be echoed back to you."
}
};

expedia.ping(options, function(err, res){
if(err)throw new Error(err);
expedia.ping(options, function(err, res) {
if (err) throw new Error(err);
console.log(res);
});

Loading