Module: BookingSync::API::Client::LivingRooms

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

Instance Method Summary collapse

Instance Method Details

#cancel_living_room(living_room) ⇒ NilClass

Cancel a living_room

Parameters:

Returns:

  • (NilClass)

    Returns nil on success.



60
61
62
# File 'lib/bookingsync/api/client/living_rooms.rb', line 60

def cancel_living_room(living_room)
  delete "living_rooms/#{living_room}"
end

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

Create a new living_room

Parameters:

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

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

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

    LivingRoom’s attributes.

Returns:



37
38
39
# File 'lib/bookingsync/api/client/living_rooms.rb', line 37

def create_living_room(rental, options = {})
  post("rentals/#{rental}/living_rooms", living_rooms: [options]).pop
end

#edit_living_room(living_room, options = {}) ⇒ BookingSync::API::Resource

Edit a living_room

Examples:

living_room = @api.living_rooms.first
@api.edit_living_room(living_room, { bunk_beds_count: 3 })

Parameters:

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

    LivingRoom or ID of the living_room to be updated.

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

    LivingRoom attributes to be updated.

Returns:



51
52
53
# File 'lib/bookingsync/api/client/living_rooms.rb', line 51

def edit_living_room(living_room, options = {})
  put("living_rooms/#{living_room}", living_rooms: [options]).pop
end

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

Get a single living_room

Parameters:

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

    LivingRoom or ID of the living_room.

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

    A customizable set of query options.

Options Hash (options):

  • fields: (Array)

    List of fields to be fetched.

Returns:



27
28
29
# File 'lib/bookingsync/api/client/living_rooms.rb', line 27

def living_room(living_room, options = {})
  get("living_rooms/#{living_room}", options).pop
end

#living_rooms(options = {}, &block) ⇒ Array<BookingSync::API::Resource>

List living_rooms

Returns living_rooms for the account user is authenticated with.

Examples:

Get the list of living_rooms for the current account

living_rooms = @api.living_rooms
living_rooms.first.bunk_beds_count # => 2

Get the list of living_rooms only with bunk_beds_count for smaller response

@api.living_rooms(fields: [:bunk_beds_count])

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • fields: (Array)

    List of fields to be fetched.

Returns:



16
17
18
# File 'lib/bookingsync/api/client/living_rooms.rb', line 16

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