Module: BookingSync::API::Client::RentalUrls

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

Instance Method Summary collapse

Instance Method Details

#cancel_rental_url(rental_url) ⇒ NilClass

Cancel a RentalUrl

Parameters:

Returns:

  • (NilClass)

    Returns nil on success.



61
62
63
# File 'lib/bookingsync/api/client/rental_urls.rb', line 61

def cancel_rental_url(rental_url)
  delete "rental_urls/#{rental_url}"
end

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

Create a new rental_url

Parameters:

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

    RentalUrl’s attributes.

Returns:



32
33
34
35
36
37
# File 'lib/bookingsync/api/client/rental_urls.rb', line 32

def create_rental_url(rental, options = {})
  if file_path = options.delete(:file_path)
    options[:file] ||= base_64_encode(file_path)
  end
  post("rentals/#{rental}/rental_urls", rental_urls: options).pop
end

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

Edit a rental_url

Examples:

rental_url = @api.rental_urls.first
@api.edit_rental_url(rental_url, { label: "Airbnb" })

Parameters:

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

    RentalUrl or ID of the rental_url to be updated.

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

    RentalUrl attributes to be updated.

Returns:



49
50
51
52
53
54
# File 'lib/bookingsync/api/client/rental_urls.rb', line 49

def edit_rental_url(rental_url, options = {})
  if file_path = options.delete(:file_path)
    options[:file] ||= base_64_encode(file_path)
  end
  put("rental_urls/#{rental_url}", rental_urls: options).pop
end

#rental_url(rental_url) ⇒ BookingSync::API::Resource

Get a single rental_url

Parameters:

Returns:



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

def rental_url(rental_url)
  get("rental_urls/#{rental_url}").pop
end

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

List rental_urls

Returns rental_urls for the account user is authenticated with.

Examples:

Get the list of rental_urls for the current account

rental_urls = @api.rental_urls
rental_urls.first.label # => "HomeAway"

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/rental_urls.rb', line 15

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

#restore_rental_url(rental_url) ⇒ BookingSync::API::Resource

Restore a RentalUrl

Parameters:

Returns:



71
72
73
# File 'lib/bookingsync/api/client/rental_urls.rb', line 71

def restore_rental_url(rental_url)
  put("rental_urls/#{rental_url}/restore").pop
end