Module: BookingSync::API::Client::Rentals
- Included in:
- BookingSync::API::Client
- Defined in:
- lib/bookingsync/api/client/rentals.rb
Instance Method Summary collapse
-
#create_rental(options = {}) ⇒ BookingSync::API::Resource
Create a new rental.
-
#delete_rental(rental) ⇒ NilClass
Delete a rental.
-
#edit_rental(rental, options = {}) ⇒ BookingSync::API::Resource
Edit a rental.
-
#rental(rental, options = {}) ⇒ BookingSync::API::Resource
Get a single rental.
-
#rentals(options = {}, &block) ⇒ Array<BookingSync::API::Resource>
List rentals.
-
#rentals_meta(rentals = nil) ⇒ BookingSync::API::Resource
Get meta information about rentals.
-
#rentals_search(options = {}, &block) ⇒ Array<BookingSync::API::Resource>
Search rentals.
Instance Method Details
#create_rental(options = {}) ⇒ BookingSync::API::Resource
Create a new rental
51 52 53 |
# File 'lib/bookingsync/api/client/rentals.rb', line 51 def create_rental( = {}) post(:rentals, rentals: []).pop end |
#delete_rental(rental) ⇒ NilClass
Delete a rental
73 74 75 |
# File 'lib/bookingsync/api/client/rentals.rb', line 73 def delete_rental(rental) delete "rentals/#{rental}" end |
#edit_rental(rental, options = {}) ⇒ BookingSync::API::Resource
Edit a rental
to be updated
64 65 66 |
# File 'lib/bookingsync/api/client/rentals.rb', line 64 def edit_rental(rental, = {}) put("rentals/#{rental}", rentals: []).pop end |
#rental(rental, options = {}) ⇒ BookingSync::API::Resource
Get a single rental
43 44 45 |
# File 'lib/bookingsync/api/client/rentals.rb', line 43 def rental(rental, = {}) get("rentals/#{rental}", ).pop end |
#rentals(options = {}, &block) ⇒ Array<BookingSync::API::Resource>
List rentals
Returns rentals for the account user is authenticated with.
17 18 19 |
# File 'lib/bookingsync/api/client/rentals.rb', line 17 def rentals( = {}, &block) paginate :rentals, , &block end |
#rentals_meta(rentals = nil) ⇒ BookingSync::API::Resource
Get meta information about rentals.
81 82 83 84 |
# File 'lib/bookingsync/api/client/rentals.rb', line 81 def (rentals = nil) path = reject_blank_values(["rentals", Array(rentals).join(","), "meta"]).join("/") get(path).pop end |
#rentals_search(options = {}, &block) ⇒ Array<BookingSync::API::Resource>
Search rentals
Returns list of light rentals. Composed of id, initial_price, final_price and updated_at.
villas = @api.rentals_search(rental_type: “villa”)
31 32 33 34 35 36 |
# File 'lib/bookingsync/api/client/rentals.rb', line 31 def rentals_search( = {}, &block) ids = Array(.delete(:ids)) path = reject_blank_values(["rentals", ids.join(","), "search"]).join("/") defaults = { request_method: :post } paginate path, defaults.merge(), &block end |