class Lifen::AppAuthenticatedClient

Private Instance Methods

bearer() click to toggle source
# File lib/lifen/app_authenticated_client.rb, line 32
def bearer
  Lifen.configuration.application_access_token
end
handle_errors(response, params) click to toggle source
Calls superclass method
# File lib/lifen/app_authenticated_client.rb, line 6
def handle_errors(response, params)
  super(response, params)

  case response.status
  when 400
    raise Error, "Error 400, Unknown error, #{response_error(response, params)}"
  when 401
    raise InvalidSecretTokenError, "Error 401, Invalid app bearer, #{response_error(response, params)}"
  when 403
    raise UserAlreadyExistingError, "Error 403, User already existing, #{response_error(response, params)}"
  when 404
    raise Error, "Error 404, Page not found, #{response_error(response, params)}"
  when 422
    json = JSON.parse response.body

    diagnostic = json["issue"][0]["diagnostics"]

    raise Error, "Error 422, Unprocessable Entity, Diagnostic: '#{diagnostic}', #{response_error(response, params)}"
  end

end
response_error(response, params) click to toggle source
# File lib/lifen/app_authenticated_client.rb, line 28
def response_error(response, params)
  "App Client, #{super(response, params)}"
end