module A55

Constants

VERSION

Public Class Methods

authenticate(token = nil) click to toggle source
# File lib/a55.rb, line 15
def authenticate(token = nil)
  app_token = token || api_token || ENV['A55_API_TOKEN']
  raise MissingApiTokenError unless app_token
  response = HTTParty.post(
    "#{configuration.auth_api}",
    body: {},
    headers:  {
      "Content-Type" => 'application/json',
      "Authorization" => "ApiKey #{app_token}"
    }
  ).parsed_response
  response.fetch('user', {}).fetch('token', nil)
end
configuration() click to toggle source
# File lib/a55.rb, line 11
def configuration
  @configuration ||= Configuration.new
end