A Ruby wrapper packaged as a Gem enabling Ruby calls to the Yello Travel Labs API which provides endpoints to search & book their inventory of Korea based rental properties. Visit Yello Travel Labs at http://www.ytlabs.co.kr/. You will need an access token.
The YTLabs API uses camelCase params, however as this is a Ruby wrapper I have followed the Ruby convention of using underscore_case parameter naming, with the exception of client.post_reservation_confirmation
. The belows README (and also the comments above the definition of each method) documents all required and optional parameter formats.
A work in progress as of July 2016, hence currently calling staging url.
httparty github.com/jnunemaker/httparty
===================
gem install 'ytlabs_api_client'
===================
client = YTLabsApi::Client.new(token, :json)
===================
Use this resource to get a response a list of properties in the YTLabs API.
- Required => updated_at Date at which data starts being returned. (YYYY-MM-
- Optional => i18n default: "ko-KR" Return text in other lanaguages(ko-KR, en-US, zh-CN,
- Optional => offset default: 0 Data offset (default 0)
- Optional => limit default: 30 Amount of requested properties (default 30)
- Optional => active default: 1 To filter by only active properties. 0 returns all. 1 returns Active o
When parameter 'limit=0&updatedAt=1970-01-01' is specified in request, all of the properties' information is
returned. It is recommended only for the first ever call made to retrieve all information.
Usage: get_property(params)
Example usage: client.get_properties(:updated_at => "1970-01-01", :limit => 3)
===================
Use this resource with a property_identifier (e.g. "w_w0307279") to get the property's information.
- Required => property_identifier The unique property identifier/hash (e.g. w_w0307279)
- Optional => i18n default: "ko-KR" Return text in other lanaguages(ko-KR, en-US, zh-CN, ja-JP)
Usage: get_property(property_identifier, params=nil)
Example usage: client.get_property("w_w0307279", :i18n => "en-US")
===================
Use this resource with a property_identifier (e.g. "w_w0307279") & a stay start_date to obtain rates & availability.
Required => property_identifier The unique property identifier/hash (e.g. w_w0307279)
Required => start_date YYYY-MM-DD (ex: 2016-02-01). Stay start date.
Optional => end_date default: (start_date + 1 day) YYYY-MM-DD (ex: 2016-02-05). Stay end date. If empty, defaults to start_date + 1 day.
Usage: get_availability(property_identifier, start_date, end_date=nil)
Example usage: client.get_availability("w_w0307279_R01", "2016-07-01", "2016-07-10")
===================
Returns a list with code or name of province.
- Optional => i18n default: "ko-KR" Return text in other lanaguages(ko-KR, en-US, zh-CN, ja-JP)
Example usage: client.get_provinces
===================
Returns a list with code or name of cities.
- Optional => i18n default: "ko-KR" Return text in other lanaguages(ko-KR, en-US, zh-CN, ja-JP)
Example usage: client.get_cities
===================
Returns a list mapping the codes and names of extra services.
- Optional => i18n default: "ko-KR" Return text in other lanaguages(ko-KR, en-US, zh-CN, ja-JP)
Example usage: client.get_extra_service_codes
===================
Returns a list mapping the code and name of themes.
- Optional => i18n default: "ko-KR" Return text in other lanaguages(ko-KR, en-US, zh-CN, ja-JP)
Example usage: client.get_theme_codes
===================
1. Use this resource with a set of dates to retrieve a collection of reservations between the given dates
2. Use this resource with a reservation identifier(hash) + the start date to retrieve a collection of one reservation.
- Required => start_date YYYY-MM-DD (ex: 2016-02-01). Search by start date.
- Required => end_date YYYY-MM-DD (ex: 2016-02-05). Search by end date.
- Optional => reservation_identifier The unique property identifier/hash (e.g. w_w03072)
Example usage: client.get_reservations("2016-07-01", "2016-07-10", "w_w0307279_R01")
===================
Use this resource to obtain a list of all room types.
- Required => updated_at Date at which data starts being returned. (YYYY-MM-
- Optional => i18n default: "ko-KR" Return text in other lanaguages(ko-KR, en-US, zh-CN, ja-
- Optional => offset default: 0 Data offset (default 0)
- Optional => limit default: 30 Amount of requested room type (default 30)
- Optional => active default: 1 To filter by only active room type. 0 returns all. 1 returns Active o
Example usage: client.get_room_types(:updated_at => "1970-01-01", :limit => 1)
===================
Using a specific propertyID, get all roomtypes' information of the property.
- Required => property_identifier Date at which data starts being returned. (YYYY-MM-
- Optional => i18n default: "ko-KR" Return text in other lanaguages(ko-KR, en-US, zh-CN, ja
Example usage: client.get_property_room_types("w_w0307279", :i81n => "en-US")
===================
Using a reservation number get the cancellation fee payable. If a reservation is cancelled within 7 days of the check in day, a cancellation fee will be charged.
- Required => reservation_number Unique reservation number
Example usage: client.get_cancellation_charge("w_WP20160705145532ECD5")
Before making a reservation, the room must be held - to prevent double booking.
Example usage: client.post_reservation_request("w_w0814002_R01", "2016-07-01", "2016-07-10")
===================
Confirm a booking.
Format expected (Ruby Hash):
request_body = {
"reservationNo" => "w_WP20160718164753DE39",
"roomtypeCode" => "w_w0814002_R01",
"checkInDate" => "2016-07-01",
"checkOutDate" => "2016-07-10",
"guestName" => "Bob",
"guestCount" => 4,
"adultCount" => 2,
"childrenCount" => 2,
"paidPrice" => 2000.0,
"sellingPrice" => 2000.0,
"commissionPrice" => 200.0,
"currency" => "KRW"
}
Example usage: client.post_reservation_confirmation(request_body)
===================
post_cancellation_request(reservation_number, paid_price, commission_price, currency) "POST /reservation/cancel"
Cancel a booking.
Example usage: client.post_cancellation_request("w_WP20160718164753DE39", 2000.0, 200.0, "KRW")