module BookingSync::API::Client::Seasons
Public Instance Methods
Create a new season
@param rates_table [BookingSync::API::Resource|Integer] Rates
table
or ID of the rates table for which a season will be created.
@param options [Hash] Season’s attributes. @return [BookingSync::API::Resource] Newly created season.
# File lib/bookingsync/api/client/seasons.rb, line 38 def create_season(rates_table, options = {}) post("rates_tables/#{rates_table}/seasons", seasons: [options]).pop end
Delete a season
@param season [BookingSync::API::Resource|Integer] Season or ID
of the season to be deleted.
@return [NilClass] Returns nil on success.
# File lib/bookingsync/api/client/seasons.rb, line 61 def delete_season(season) delete "seasons/#{season}" end
Edit a season
@param season [BookingSync::API::Resource|Integer] Season or ID of
the season to be updated.
@param options [Hash] Season attributes to be updated. @return [BookingSync::API::Resource] Updated season on success,
exception is raised otherwise.
@example
season = @api.seasons.first @api.edit_season(season, { name: "Some season" })
# File lib/bookingsync/api/client/seasons.rb, line 52 def edit_season(season, options = {}) put("seasons/#{season}", seasons: [options]).pop end
Get a single season
@param season [BookingSync::API::Resource|Integer] Season or ID
of the season.
@param options [Hash] A customizable set of query options. @option options [Array] fields: List of fields to be fetched. @return [BookingSync::API::Resource]
# File lib/bookingsync/api/client/seasons.rb, line 28 def season(season, options = {}) get("seasons/#{season}", options).pop end
List seasons
Returns seasons for the account user is authenticated with. @param options [Hash] A customizable set of options. @option options [Array] fields: List of fields to be fetched. @return [Array<BookingSync::API::Resource>] Array of seasons.
@example Get the list of seasons for the current account
seasons = @api.seasons seasons.first.name # => "Season 2"
@example Get the list of seasons only with name and ratio for smaller response
@api.seasons(fields: [:name, :ratio])
@see developers.bookingsync.com/reference/endpoints/seasons/#list-seasons
# File lib/bookingsync/api/client/seasons.rb, line 17 def seasons(options = {}, &block) paginate :seasons, options, &block end