Module: BookingSync::API::Client::RentalsAmenities

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

Instance Method Summary collapse

Instance Method Details

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

Create a rental’s amenity

Examples:

Create a rental’s amenity.

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

Parameters:

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

    Rental object or ID for which the rental amenity will be created.

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

    Rental Amenity’ s attributes.

Returns:

See Also:



37
38
39
# 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) ⇒ NilClass

Delete a rentals_amenity

Parameters:

Returns:

  • (NilClass)

    Returns nil on success.



60
61
62
# 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 = {}) ⇒ BookingSync::API::Resource

Edit a rentals_amenity

Examples:

rentals_amenity = @api.rentals_amenities.first
@api.edit_rentals_amenity(rentals_amenity, { details_en: "Details" })

Parameters:

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

    RentalsAmenity or ID of the rentals_amenity to be updated.

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

    rentals_amenity attributes to be updated.

Returns:



51
52
53
# 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) ⇒ Array<BookingSync::API::Resource>

List rentals_amenities

Returns all amenities used by rentals for the current account.

Examples:

Get the list of amenities for the current account

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

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • fields: (Array)

    List of fields to be fetched.

Returns:

See Also:



15
16
17
# 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) ⇒ BookingSync::API::Resource

Get a single rentals_amenity

rentals_amenity or ID of the rentals_amenity.

Parameters:

Returns:



24
25
26
# File 'lib/bookingsync/api/client/rentals_amenities.rb', line 24

def rentals_amenity(rentals_amenity)
  get("rentals_amenities/#{rentals_amenity}").pop
end