3. Getting Started - mihilbabin/guesty_api GitHub Wiki

Getting Started

Basic usage

  1. Create an instance of GuestyAPI::Client by using your Guesty credentials
client = GuestyAPI::Client.new(username: '<API-KEY>', password: '<SECRET-KEY>')

This is default HTTP Basic Authentication provided by Guesty. You can read more about the client in a corresponding section.

  1. Create any resource-based class by using a client
users = GuestyAPI::Users.new client

users will be your source for performing API operations such as list, create, retrieve etc.

  1. Perform operations on your resource by using methods that have similar to Guesty API wording.
# Get all users on file
users.list

# Get user by ID
users.retrieve id: '5803ca18e48f450300c76173'

# Delete user by ID
users.delete id: '5803ca18e48f450300c76173'

For the full resource reference please read the section about resources.

  1. The returned result may be one of the following: a list of entities, a single entity, true, raised GuestyAPI::APIError. To discover what entities are - go here. To figure out what errors you may see - visit Errors Handling page.
⚠️ **GitHub.com Fallback** ⚠️