Module: BookingSync::API::Client::Hosts

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

Instance Method Summary collapse

Instance Method Details

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

Create a new host

Parameters:

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

    Host’s attributes.

Returns:



32
33
34
# File 'lib/bookingsync/api/client/hosts.rb', line 32

def create_host(options = {})
  post(:hosts, hosts: [options]).pop
end

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

Edit a host

Examples:

host = @api.hosts.first
@api.edit_host(host, { firstname: "Johnny" })

Parameters:

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

    Host or ID of the host to be updated.

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

    Host attributes to be updated.

Returns:



46
47
48
# File 'lib/bookingsync/api/client/hosts.rb', line 46

def edit_host(host, options = {})
  put("hosts/#{host}", hosts: [options]).pop
end

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

Get a single host

Parameters:

Returns:



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

def host(host)
  get("hosts/#{host}").pop
end

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

List hosts

Returns all hosts supported in BookingSync.

Examples:

Get the list of hosts for the current account

hosts = @api.hosts
hosts.first.email # => "[email protected]"

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

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