Class: ActiveRecordApi::Request::TokenRetriever

Inherits:
Methods show all
Defined in:
lib/active_record_api/request/token_retriever.rb

Instance Attribute Summary collapse

Attributes inherited from Connection

#cache_store, #debug, #full_url, #timeout

Attributes inherited from Credentials

#email, #password, #token

Instance Method Summary collapse

Methods inherited from Methods

#get, #health_endpoint, #post, #put, #query, #service_healthy?

Methods inherited from Connection

#authenticated_connection, #connection, #full_url_with_params, #http_cache_options, #service_url, #strip_double_slash, #strip_trailing_slash, #symbolize_array_response, #symbolize_response

Methods inherited from Credentials

#config, #credentials_config

Instance Attribute Details

#credentialsObject

Returns the value of attribute credentials.



5
6
7
# File 'lib/active_record_api/request/token_retriever.rb', line 5

def credentials
  @credentials
end

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/active_record_api/request/token_retriever.rb', line 5

def host
  @host
end

#token_pathObject Also known as: path

Returns the value of attribute token_path.



5
6
7
# File 'lib/active_record_api/request/token_retriever.rb', line 5

def token_path
  @token_path
end

Instance Method Details

#fetch_tokenObject



9
10
11
# File 'lib/active_record_api/request/token_retriever.rb', line 9

def fetch_token
  post(payload: credentials)[:token]
end

#headersObject



13
14
15
# File 'lib/active_record_api/request/token_retriever.rb', line 13

def headers
  @headers ||= {}
end