module BookingSync::API::Client::Hosts
Public Instance Methods
Create a new host
@param options [Hash] Host’s attributes. @return [BookingSync::API::Resource] Newly created host.
# File lib/bookingsync/api/client/hosts.rb, line 32 def create_host(options = {}) post(:hosts, hosts: [options]).pop end
Edit a host
@param host [BookingSync::API::Resource|Integer] Host or ID of
the host to be updated.
@param options [Hash] Host attributes to be updated. @return [BookingSync::API::Resource] Updated host on success,
exception is raised otherwise.
@example
host = @api.hosts.first @api.edit_host(host, { firstname: "Johnny" })
# File lib/bookingsync/api/client/hosts.rb, line 46 def edit_host(host, options = {}) put("hosts/#{host}", hosts: [options]).pop end
Get a single host
@param host [BookingSync::API::Resource|Integer] Host or ID
of the host.
@return [BookingSync::API::Resource]
# File lib/bookingsync/api/client/hosts.rb, line 24 def host(host) get("hosts/#{host}").pop end
List hosts
Returns all hosts supported in BookingSync
. @param options [Hash] A customizable set of options. @option options [Array] fields: List of fields to be fetched. @return [Array<BookingSync::API::Resource>] Array of hosts.
@example Get the list of hosts for the current account
hosts = @api.hosts hosts.first.email # => "host_email@example.com"
@see developers.bookingsync.com/reference/endpoints/hosts/#list-hosts
# File lib/bookingsync/api/client/hosts.rb, line 15 def hosts(options = {}, &block) paginate :hosts, options, &block end