module BookingSync::API::Client::Bathrooms
Public Instance Methods
Get a single bathroom
@param bathroom [BookingSync::API::Resource|Integer] Bedroom or ID
of the bathroom.
@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/bathrooms.rb, line 27 def bathroom(bathroom, options = {}) get("bathrooms/#{bathroom}", options).pop end
List bathrooms
Returns bathrooms 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 bathrooms.
@example Get the list of bathrooms for the current account
bathrooms = @api.bathrooms bathrooms.first.name # => "Bathroom 2"
@example Get the list of bathrooms only with name for smaller response
@api.bathrooms(fields: [:name])
# File lib/bookingsync/api/client/bathrooms.rb, line 16 def bathrooms(options = {}, &block) paginate :bathrooms, options, &block end
Cancel a bathroom
@param bathroom [BookingSync::API::Resource|Integer] Bathroom or ID
of the bathroom to be canceled.
@return [NilClass] Returns nil on success.
# File lib/bookingsync/api/client/bathrooms.rb, line 60 def cancel_bathroom(bathroom) delete "bathrooms/#{bathroom}" end
Create a new bathroom
@param rental [BookingSync::API::Resource|Integer] Rental or ID of
the rental for which bathroom will be created.
@param options [Hash] Bathroom’s attributes. @return [BookingSync::API::Resource] Newly created bathroom.
# File lib/bookingsync/api/client/bathrooms.rb, line 37 def create_bathroom(rental, options = {}) post("rentals/#{rental}/bathrooms", bathrooms: [options]).pop end
Edit a bathroom
@param bathroom [BookingSync::API::Resource|Integer] Bathroom or ID of
the bathroom to be updated.
@param options [Hash] Bathroom attributes to be updated. @return [BookingSync::API::Resource] Updated bathroom on success,
exception is raised otherwise.
@example
bathroom = @api.bathrooms.first @api.edit_bathroom(bathroom, { name: "Some bathroom" })
# File lib/bookingsync/api/client/bathrooms.rb, line 51 def edit_bathroom(bathroom, options = {}) put("bathrooms/#{bathroom}", bathrooms: [options]).pop end