module BookingSync::API::Client::RentalAgreements

Public Instance Methods

create_rental_agreement(options = {}) click to toggle source

Create a new rental agreement for an account.

@param options [Hash] Rental agreement’s attributes. @return [BookingSync::API::Resource] Newly created rental agreement.

# File lib/bookingsync/api/client/rental_agreements.rb, line 59
def create_rental_agreement(options = {})
  post(:rental_agreements, rental_agreements: [options]).pop
end
create_rental_agreement_for_booking(booking, options = {}) click to toggle source

Create a new rental agreement for a booking.

@param booking [BookingSync::API::Resource|Integer] Booking or ID of

the booking for which rental agreement will be created.

@param options [Hash] Rental agreement’s attributes. @return [BookingSync::API::Resource] Newly created rental agreement.

# File lib/bookingsync/api/client/rental_agreements.rb, line 39
def create_rental_agreement_for_booking(booking, options = {})
  post("bookings/#{booking}/rental_agreements",
    rental_agreements: [options]).pop
end
create_rental_agreement_for_rental(rental, options = {}) click to toggle source

Create a new rental agreement for a rental.

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

the rental for which rental agreement will be created.

@param options [Hash] Rental agreement’s attributes. @return [BookingSync::API::Resource] Newly created rental agreement

# File lib/bookingsync/api/client/rental_agreements.rb, line 50
def create_rental_agreement_for_rental(rental, options = {})
  post("rentals/#{rental}/rental_agreements",
    rental_agreements: [options]).pop
end
rental_agreement(rental_agreement, options = {}) click to toggle source

Get a single rental_agreement

@param rental_agreement [BookingSync::API::Resource|Integer] RentalAgreement or ID

of the rental_agreement.

@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/rental_agreements.rb, line 29
def rental_agreement(rental_agreement, options = {})
  get("rental_agreements/#{rental_agreement}", options).pop
end
rental_agreements(options = {}, &block) click to toggle source

List rental agreements.

Returns rental agreements for the rentals of 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 rental agreements.

@example Get the list of rental agreements for the current account

agreement = @api.rental_agreements
agreement.first.body # => "My rental agreement"

@example Get the list of rental agreements only with body for smaller response

@api.rentals(fields: :body)

@see developers.bookingsync.com/reference/endpoints/rental_agreements/#list-rental_agreements

# File lib/bookingsync/api/client/rental_agreements.rb, line 18
def rental_agreements(options = {}, &block)
  paginate :rental_agreements, options, &block
end