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:



36
37
38
# File 'lib/bookingsync/api/client/rates_tables.rb', line 36

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



59
60
61
# File 'lib/bookingsync/api/client/rates_tables.rb', line 59

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:



50
51
52
# File 'lib/bookingsync/api/client/rates_tables.rb', line 50

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

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

Get a single rates_table

Parameters:

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

    RatesTable or ID of the rates_table.

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

    A customizable set of query options.

Options Hash (options):

  • fields: (Array)

    List of fields to be fetched.

Returns:



28
29
30
# File 'lib/bookingsync/api/client/rates_tables.rb', line 28

def rates_table(rates_table, options = {})
  get("rates_tables/#{rates_table}", 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