module BookingSync::API::Client::RentalsAmenities

Public Instance Methods

create_rentals_amenity(rental, options = {}) click to toggle source

Create a rental’s amenity

@param rental [BookingSync::API::Resource|Integer] Rental object or ID

for which the rental amenity will be created.

@param options [Hash] Rental Amenity’ s attributes. @return [BookingSync::API::Resource] Newly created rental’s amenity. @example Create a rental’s amenity.

@api.create_rentals_amenity(10, { amenity_id: 50 }) # Add the Internet amenity to the rental with ID 10

@see developers.bookingsync.com/reference/endpoints/rentals_amenities/#create-a-new-rentals-amenity

# File lib/bookingsync/api/client/rentals_amenities.rb, line 37
def create_rentals_amenity(rental, options = {})
  post("rentals/#{rental}/rentals_amenities", rentals_amenities: [options]).pop
end
delete_rentals_amenity(rentals_amenity) click to toggle source

Delete a rentals_amenity

@param rentals_amenity [BookingSync::API::Resource|Integer] RentalsAmenity or ID

of the rentals_amenity to be deleted.

@return [NilClass] Returns nil on success.

# File lib/bookingsync/api/client/rentals_amenities.rb, line 60
def delete_rentals_amenity(rentals_amenity)
  delete "rentals_amenities/#{rentals_amenity}"
end
edit_rentals_amenity(rentals_amenity, options = {}) click to toggle source

Edit a rentals_amenity

@param rentals_amenity [BookingSync::API::Resource|Integer] RentalsAmenity or ID of

the rentals_amenity to be updated.

@param options [Hash] rentals_amenity attributes to be updated. @return [BookingSync::API::Resource] Updated rentals_amenity on success,

exception is raised otherwise.

@example

rentals_amenity = @api.rentals_amenities.first
@api.edit_rentals_amenity(rentals_amenity, { details_en: "Details" })
# File lib/bookingsync/api/client/rentals_amenities.rb, line 51
def edit_rentals_amenity(rentals_amenity, options = {})
  put("rentals_amenities/#{rentals_amenity}", rentals_amenities: [options]).pop
end
rentals_amenities(options = {}, &block) click to toggle source

List rentals_amenities

Returns all amenities used by rentals for the current account. @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 rentals_amenities.

@example Get the list of amenities for the current account

rentals_amenities = @api.rentals_amenities
rentals_amenities.first.amenity.title # => "Internet"

@see developers.bookingsync.com/reference/endpoints/rentals_amenities/#list-rentals-amenities

# File lib/bookingsync/api/client/rentals_amenities.rb, line 15
def rentals_amenities(options = {}, &block)
  paginate :rentals_amenities, options, &block
end
rentals_amenity(rentals_amenity) click to toggle source

Get a single rentals_amenity

@param rentals_amenity [BookingSync::API::Resource|Integer] rentals_amenity or ID of the rentals_amenity. @return [BookingSync::API::Resource]

# File lib/bookingsync/api/client/rentals_amenities.rb, line 24
def rentals_amenity(rentals_amenity)
  get("rentals_amenities/#{rentals_amenity}").pop
end