Sha256: a2a8ad8198bc78f893d058acf078a95e78e1718e1d7fa0ce6cbc9082b4ab28f3
Contents?: true
Size: 863 Bytes
Versions: 7
Compression:
Stored size: 863 Bytes
Contents
module LifenFhir class UserAuthenticatedClient < Client def initialize(token) @token = token end attr_reader :token private def handle_errors(response, params) super(response, params) case response.status when 400 raise InvalidParamsError, "Error 400, Invalid params, #{response_error(response, params)}" when 401 raise UnauthorizedError, "Error 401, Token is not valid, #{response_error(response, params)}" when 403 raise Error, "Error 403, Action is forbidden, #{response_error(response, params)}" end end def response_error(response, params) "User Client, #{super(response, params)}" end def bearer token.value end def before_request token.refresh_once_if_needed end end end
Version data entries
7 entries across 7 versions & 1 rubygems