Module: BookingSync::API::Client::RentalAgreements

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

Instance Method Summary collapse

Instance Method Details

#create_rental_agreement(options = {}) ⇒ BookingSync::API::Resource

Create a new rental agreement for an account.

Parameters:

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

    Rental agreement’s attributes.

Returns:



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

Create a new rental agreement for a booking.

Parameters:

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

    Booking or ID of the booking for which rental agreement will be created.

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

    Rental agreement’s attributes.

Returns:



39
40
41
42
# 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 = {}) ⇒ BookingSync::API::Resource

Create a new rental agreement for a rental.

Parameters:

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

    Rental or ID of the rental for which rental agreement will be created.

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

    Rental agreement’s attributes.

Returns:



50
51
52
53
# 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 = {}) ⇒ BookingSync::API::Resource

Get a single rental_agreement

Parameters:

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

    RentalAgreement or ID of the rental_agreement.

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

    A customizable set of query options.

Options Hash (options):

  • fields: (Array)

    List of fields to be fetched.

Returns:



29
30
31
# 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) ⇒ Array<BookingSync::API::Resource>

List rental agreements.

Returns rental agreements for the rentals of the account

user is authenticated with.

Examples:

Get the list of rental agreements for the current account

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

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

@api.rentals(fields: :body)

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • fields: (Array)

    List of fields to be fetched.

Returns:

See Also:



18
19
20
# File 'lib/bookingsync/api/client/rental_agreements.rb', line 18

def rental_agreements(options = {}, &block)
  paginate :rental_agreements, options, &block
end