class LosantRest::OrgInvites

Class containing all the actions for the Org Invites Resource

Public Class Methods

new(client) click to toggle source
# File lib/losant_rest/org_invites.rb, line 30
def initialize(client)
  @client = client
end

Public Instance Methods

get(params = {}) click to toggle source

Gets information about an invite

Authentication: No api access token is required to call this action.

Parameters:

  • {string} token - The token associated with the invite

  • {string} email - The email associated with the invite

  • {string} losantdomain - Domain scope of request (rarely needed)

  • {boolean} _actions - Return resource actions in response

  • {boolean} _links - Return resource link in response

  • {boolean} _embedded - Return embedded resources in response

Responses:

Errors:

# File lib/losant_rest/org_invites.rb, line 54
def get(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil

  raise ArgumentError.new("token is required") unless params.has_key?(:token)
  raise ArgumentError.new("email is required") unless params.has_key?(:email)

  query_params[:token] = params[:token] if params.has_key?(:token)
  query_params[:email] = params[:email] if params.has_key?(:email)
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
  query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)

  path = "/invites"

  @client.request(
    method: :get,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end
post(params = {}) click to toggle source

Accepts/Rejects an invite

Authentication: No api access token is required to call this action.

Parameters:

  • {hash} invite - Invite info and acceptance (api.losant.com/#/definitions/orgInviteAction)

  • {string} losantdomain - Domain scope of request (rarely needed)

  • {boolean} _actions - Return resource actions in response

  • {boolean} _links - Return resource link in response

  • {boolean} _embedded - Return embedded resources in response

Responses:

Errors:

# File lib/losant_rest/org_invites.rb, line 99
def post(params = {})
  params = Utils.symbolize_hash_keys(params)
  query_params = { _actions: false, _links: true, _embedded: true }
  headers = {}
  body = nil

  raise ArgumentError.new("invite is required") unless params.has_key?(:invite)

  body = params[:invite] if params.has_key?(:invite)
  headers[:losantdomain] = params[:losantdomain] if params.has_key?(:losantdomain)
  query_params[:_actions] = params[:_actions] if params.has_key?(:_actions)
  query_params[:_links] = params[:_links] if params.has_key?(:_links)
  query_params[:_embedded] = params[:_embedded] if params.has_key?(:_embedded)

  path = "/invites"

  @client.request(
    method: :post,
    path: path,
    query: query_params,
    headers: headers,
    body: body)
end