class Round::Client

Constants

OTPConflictError
UnknownKeyError

Public Class Methods

new(patchboard_client) click to toggle source
# File lib/round/client.rb, line 18
def initialize(patchboard_client)
  @patchboard_client = patchboard_client
end

Public Instance Methods

application() click to toggle source
# File lib/round/client.rb, line 62
def application
  Application.new(resource: resources.app.get, client: self)
end
authenticate_application(api_token:, admin_token:) click to toggle source
# File lib/round/client.rb, line 22
def authenticate_application(api_token:, admin_token:)
  @patchboard_client
    .context
    .authorize(Context::Scheme::APPLICATION,
      api_token: api_token, admin_token: admin_token)
  authenticate_identify(api_token: api_token)

  self.application.refresh
end
authenticate_device(email:, api_token:, device_token:) click to toggle source
# File lib/round/client.rb, line 42
def authenticate_device(email:, api_token:, device_token:)
  @patchboard_client
    .context
    .authorize(Context::Scheme::DEVICE,
      api_token: api_token, device_token: device_token)
  @patchboard_client
    .context
    .authorize(Context::Scheme::IDENTIFY,
      api_token: api_token)
  self.user(email).refresh
end
authenticate_identify(api_token:) click to toggle source
# File lib/round/client.rb, line 36
def authenticate_identify(api_token:)
  @patchboard_client
    .context
    .authorize(Context::Scheme::IDENTIFY, api_token: api_token)
end
context() click to toggle source
# File lib/round/client.rb, line 32
def context
  @patchboard_client.context
end
resources() click to toggle source
# File lib/round/client.rb, line 54
def resources
  @patchboard_client.resources
end
user(email) click to toggle source
# File lib/round/client.rb, line 66
def user(email)
  User.new(resource: resources.user_query(email: email), client: self, email: email)
end
users() click to toggle source
# File lib/round/client.rb, line 58
def users
  UserCollection.new(resource: resources.users, client: self)
end