Module: BookingSync::API::Client::RatesTables

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

Instance Method Summary collapse

Instance Method Details

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

Create a new rates_table

Parameters:

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

    rates_table attributes

Returns:



25
26
27
# File 'lib/bookingsync/api/client/rates_tables.rb', line 25

def create_rates_table(options = {})
  post(:rates_tables, rates_tables: [options]).pop
end

#delete_rates_table(rates_table) ⇒ NilClass

Delete a rates_table

Parameters:

Returns:

  • (NilClass)

    Returns nil on success



48
49
50
# File 'lib/bookingsync/api/client/rates_tables.rb', line 48

def delete_rates_table(rates_table)
  delete "rates_tables/#{rates_table}"
end

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

Edit a rates_table

ID of the rates table to be updated exception is raised otherwise

Examples:

rates_table = @api.rates_tables.first
@api.edit_rates_table(rates_table, { name: "Lorem" })

Parameters:

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

    rates table or

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

    rates table attributes to be updated

Returns:



39
40
41
# File 'lib/bookingsync/api/client/rates_tables.rb', line 39

def edit_rates_table(rates_table, options = {})
  put("rates_tables/#{rates_table}", rates_tables: [options]).pop
end

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

List rates table

Returns rates tables for the account user is authenticated with.

Examples:

Get the list of rates tables for the current account

rates_tables = @api.rates_tables
rates_tables.first.name # => "Rates table 2"

Get the list of rates tables only with name and account_id for smaller response

@api.rates_tables(fields: [:name, :account_id])

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • fields: (Array)

    List of fields to be fetched.

Returns:

See Also:



17
18
19
# File 'lib/bookingsync/api/client/rates_tables.rb', line 17

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