Module: BookingSync::API::Client::Rates

Included in:
BookingSync::API::Client
Defined in:
lib/bookingsync/api/client/rates.rb

Instance Method Summary collapse

Instance Method Details

#rate(rate, options = {}) ⇒ BookingSync::API::Resource

Get a single rate

Parameters:

  • rate (BookingSync::API::Resource|Integer)

    Rate or ID of the rate.

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

    A customizable set of query options.

Options Hash (options):

  • fields: (Array)

    List of fields to be fetched.

Returns:



29
30
31
# File 'lib/bookingsync/api/client/rates.rb', line 29

def rate(rate, options = {})
  get("rates/#{rate}", options).pop
end

#rates(options = {}, &block) ⇒ Array<BookingSync::API::Resource>

List rates

Returns rates for the rentals of the account user is authenticated with.

Examples:

Get the list of rates for the current account

rates = @api.rates
rates.first.final_nightly_rate # => 700

Get the list of rates only with final rates

for smaller response
@api.rates(fields: %w(final_nightly_rate final_weekely_rate final_monthly_rate))

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • fields: (Array)

    List of fields to be fetched.

Returns:

See Also:



18
19
20
# File 'lib/bookingsync/api/client/rates.rb', line 18

def rates(options = {}, &block)
  paginate :rates, options, &block
end