Module: HomeAway::API::Domain::Quote

Included in:
Client
Defined in:
lib/homeaway/api/domain/quote.rb

Instance Method Summary collapse

Instance Method Details

#quote(listing_id, unit_id, adults_count, arrival_date, departure_date, opts = {}) ⇒ HomeAway::API::Response Also known as: book_stay

Generates an up to date quote and booking url

analogous to calling a GET on API url /public/bookStay

Headers:

  • X-HomeAway-DisplayLocale: If a locale is not specified in a query param, it will be searched for in the X-HomeAway-DisplayLocale Header. If it is not supplied in either area the default locale of the user will be selected if it exists. Otherwise the Accept-Language Header will be used.

Parameters:

  • listing_id (String)

    The listing id to be booked as retrieved from the search operation

  • unit_id (String)

    The id of the unit being booked for the stay

  • adults_count (Integer)

    The number of adults being booked for the stay

  • departure_date (String)

    The departure date in the form yyyy-MM-dd

  • arrival_date (String)

    The arrival date in the form yyyy-MM-dd

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :currency_code (String)

    The currency to generate the quote in (optional defaults to USD)

  • :pet_included (Boolean)

    Optional boolean indicating that a pet will accompany the guests

  • :children_count (Integer)

    The optional number of children being booked for the stay

Returns:



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/homeaway/api/domain/quote.rb', line 37

def quote(listing_id, unit_id, adults_count, arrival_date, departure_date, opts={})
  params = {
      'listingId' => listing_id.to_s,
      'unitId' => unit_id.to_s,
      'departureDate' => HomeAway::API::Util::Validators.date(departure_date),
      'adultsCount' => HomeAway::API::Util::Validators.integer(adults_count),
      'arrivalDate' => HomeAway::API::Util::Validators.date(arrival_date),
      'locale' => 'en'
  }.merge(HomeAway::API::Util::Validators.query_keys(opts))
  get '/public/quote', params
end