README.textile in expedia-0.0.1 vs README.textile in expedia-0.0.2
- old
+ new
@@ -2,12 +2,13 @@
Expedia is a ruby wrapper for ["EAN - Expedia Affiliate Network":http://www.expediaaffiliate.com] APIs.
Other details of this gem are:
-* It uses the the latest verion of the EAN API. i.e ["Version 3":http://developer.ean.com/docs/read/hotels/version_3]
+* It uses the the latest verion of the EAN API. i.e ["Version 3":http://developer.ean.com/docs/api-change-log]
* Only REST API support (No XML or SOAP support)
+* It uses Signature Pro method for Authentication. See ["Live API Key Authentication and Access":http://developer.ean.com/docs/getting-started/authentication/]
h2. Installation
For Rails Add this line to your application's Gemfile:
@@ -36,33 +37,33 @@
Expedia.locale = 'en_US'
Expedia.currency_code = 'USD'
Expedia.minor_rev = 13
</pre>
-Or you can execute the following command to create an intializer:
+Or you can execute the following command to create an intializer (if you are using rails)
<pre>
-$ rake expedia:initialize
+$ rails g expedia:initialize
</pre>
h2. Usage
-After configuring keys for your EAN application kyes, Default locale, currency and minor_rev use
+After configuring keys, default locale, currency and minor_rev for EAN use
<pre>
# Instentiate api object
-api = Expedia::API.new
+api = Expedia::Api.new
-# Method to search hotel. see http://developer.ean.com/docs/read/hotels/version_3/request_hotel_list
+# Method to search for a hotel. see http://developer.ean.com/docs/hotel-list/
response = api.get_list({:propertyName => 'Hotel Moa Berlin', :destinationString => 'berlin'})
+
+# execute this method to know if there is any exception
+response.exception? # false if success
</pre>
Following methods are expeosed by Expedia::API object
-Note: All method naming is done in correspondence with Expedia services and ruby conventions
-see "Hotel API Documentation - Services section":http://developer.ean.com/docs/read/hotels#.UMf_hiNDt0w
-
<pre>
get_list({})
geo_search({})
get_availability({})
get_room_images({})
@@ -75,31 +76,29 @@
get_cancel({})
get_ping({})
get_static_reservation({}) # To test Reservation (Static Reservation)
</pre>
-Every method accepts Hash of parameter specific to every API. see ["EAN Docs":http://developer.ean.com/docs/read/hotels/version_3] for more details.
-
h3. Success
if request is successfull you will get a Expedia::HTTPService::Response object in response.
and you can use
<pre>
response.status
-response.body
+response.body # Returns Parsed body of response.
response.headers
</pre>
h3. Error
In case of any error a Expedia::APIError object is returned.
-Note: Expedia responds with status of 200 even if there is an exception (most of the times). So no Exception is raised!
+**Note**: Expedia responds with status of 200 even if there is an exception (most of the times). So no Exception is raised!
<pre>
-# See http://developer.ean.com/docs/read/error_handling/Hotel_V3_Exception_Details
+# See http://developer.ean.com/docs/error-handling/hotel-v3-exception-details/
response.status # Response status
response.error_body # Complete error body
response.category # Value indicating the nature of the exception or the reason it occurred
response.presentation_message # Presentation error message returned
@@ -107,22 +106,22 @@
response.handling # value indicating the severity of the exception and how it may be handled
</pre>
h3. Test Booking (Static Reservation)
-For Static reservation use get_static_reservation() method.
+For Static reservation use @get_static_reservation()@ method.
-CAUTION: Do Not send adress and booking information (creditCardNumber, creditCardIdentifier, creditCardExpirationMonth, creditCardExpirationYear, address1) in parameters to the method. Especially do not pass address1 parameter They are already been taken care of. For more on Static booking see ["Static Test Booking Credit Card Information":http://developer.ean.com/docs/Test_Booking_Procedures]
+**CAUTION**: Do Not send adress and booking information (creditCardNumber, creditCardIdentifier, creditCardExpirationMonth, creditCardExpirationYear, address1) in parameters to the method. Especially do not pass address1 parameter They are already been taken care of. For more on Static booking see ["Static Test Booking Credit Card Information":http://developer.ean.com/docs/Test_Booking_Procedures]
A static Booking example.
<pre>
response = api.get_static_reservation({ :arrivalDate => "10/10/2013", :departureDate => "10/12/2013",
- :hotelID => 359433, :supplierType => "E", :rateKey => "084eab14-335e-46d6-aa2e-766fce6be32c",
- :roomTypeCode => 200007964, :rateCode => 200865704, :chargeableRate => "142.8",
- :room1 => "1", :room1FirstName => "test", :room1LastName => "testers", :room1BedTypeId => "15",
- :room1SmokingPreference => "NS", :email => "test@tesing.com", :city => 'Bellevue',
- :stateProvinceCode => 'WA', :countryCode => 'US', :postalCode => 98004 })
+ :hotelID => 359433, :supplierType => "E", :rateKey => "084eab14-335e-46d6-aa2e-766fce6be32c",
+ :roomTypeCode => 200007964, :rateCode => 200865704, :chargeableRate => "142.8",
+ :room1 => "1", :room1FirstName => "test", :room1LastName => "testers", :room1BedTypeId => "15",
+ :room1SmokingPreference => "NS", :email => "test@tesing.com", :city => 'Bellevue',
+ :stateProvinceCode => 'WA', :countryCode => 'US', :postalCode => 98004 })
</pre>
h3. Logging
Expedia::Utils.logger points to STDOUT by default. You can use it to Log in Rails Applications