module Roqua module CoreApi module Sessions class TokenSession < AuthSession attr_reader :access_token def initialize(access_token:, **additional_arguments) @access_token = access_token super(**additional_arguments) end def logout delete 'sessions/destroy' end # ping the server to check if session is still valid. # Will throw NoSession as usual if not. def ping get "/ping" end private def access_denied(response) if response['no_session'] fail NoSession else fail Unauthorized end end def headers(_request_method, _path, _params) {"Authorization" => "Session #{access_token}"} end end end end end