Module: BookingSync::API::Client::Seasons

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

Instance Method Summary collapse

Instance Method Details

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

Create a new season

Parameters:

  • rates_table_id (Integer) —

    ID of the rates table

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

    season attributes

Returns:



26
27
28
# File 'lib/bookingsync/api/client/seasons.rb', line 26

def create_season(rates_table_id, options = {})
  post(:seasons, rates_table_id: rates_table_id, seasons: [options]).pop
end

#delete_season(season, options = {}) ⇒ Array

Delete a season

to be deleted

Parameters:

Returns:

  • (Array) —

    An empty Array on success, exception is raised otherwise



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

def delete_season(season, options = {})
  delete "seasons/#{season}"
end

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

Edit a season

to be updated

Examples:

season = @api.seasons.first
@api.edit_season(season, { name: "Some season" })

Parameters:

  • season (BookingSync::API::Resource|Integer) —

    season or ID of the season

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

    season attributes to be updated

Returns:



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

def edit_season(season, options = {})
  put("seasons/#{season}", seasons: [options]).pop
end

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

List seasons

Returns seasons for the account user is authenticated with.

Examples:

Get the list of seasons for the current account

seasons = @api.seasons
seasons.first.name # => "Season 2"

Get the list of seasons only with name and ratio for smaller response

@api.seasons(fields: [:name, :ratio])

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/seasons.rb', line 17

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