lib/cerner/oauth1a/access_token_agent.rb
def retrieve(principal: nil, ignore_cache: false)
        cache_key = "#{@consumer_key}&#{principal}"

        if @access_token_cache && !ignore_cache
          cache_entry = @access_token_cache.get('cerner-oauth1a/access-tokens', cache_key)
          return cache_entry.value if cache_entry
        end

        # generate token request info
        timestamp = generate_timestamp
        accessor_secret = generate_accessor_secret

        request = retrieve_prepare_request(timestamp: timestamp, accessor_secret: accessor_secret, principal: principal)
        response = http_client.request(request)
        access_token =
          retrieve_handle_response(response: response, timestamp: timestamp, accessor_secret: accessor_secret)
        @access_token_cache&.put('cerner-oauth1a/access-tokens', cache_key, Cache::AccessTokenEntry.new(access_token))
        access_token
      end
# Public: Retrieves an AccessToken from the configured Access Token service endpoint (#access_token_url).
# This method will use the #generate_accessor_secret, #generate_nonce and #generate_timestamp methods to
# interact with the service, which can be overridden via a sub-class, if desired.
#
# keywords - The keyword arguments:
#            :principal    - An optional principal identifier, which is passed via the
#                            xoauth_principal protocol parameter.
#            :ignore_cache - A flag for indicating that the cache should be ignored and a new
#                            Access Token should be retrieved.
#
# Returns a AccessToken upon success.
#
# Raises OAuthError for any functional errors returned within an HTTP 200 response.
# Raises StandardError sub-classes for any issues interacting with the service, such as networking issues.
Retrieves an AccessToken from the configured Access Token service endpoint (#access_token_url).
This method will use the #generate_accessor_secret, #generate_nonce and #generate_timestamp methods to
interact with the service, which can be overridden via a sub-class, if desired.

The keyword arguments:
:principal    - An optional principal identifier, which is passed via the
xoauth_principal protocol parameter.
:ignore_cache - A flag for indicating that the cache should be ignored and a new
Access Token should be retrieved.

Returns a AccessToken upon success.

Raises OAuthError for any functional errors returned within an HTTP 200 response.
Raises StandardError sub-classes for any issues interacting with the service, such as networking issues.
Retrieves an AccessToken from the configured Access Token service endpoint ( #access_token_url ) . This method will use the #generate_accessor_secret #generate_nonce and #generate_timestamp methods to interact with the service which can be overridden via a sub - class if desired . The keyword arguments : : principal - An optional principal identifier which is passed via the xoauth_principal protocol parameter . : ignore_cache - A flag for indicating that the cache should be ignored and a new Access Token should be retrieved . Returns a AccessToken upon success . Raises OAuthError for any functional errors returned within an HTTP 200 response . Raises StandardError sub - classes for any issues interacting with the service such as networking issues .
def retrieve(principal: nil, ignore_cache: false)
        cache_key = "#{@consumer_key}&#{principal}"
        if @access_token_cache && !ignore_cache
          cache_entry = @access_token_cache.get('cerner-oauth1a/access-tokens', cache_key)
          return cache_entry.value if cache_entry
        end
        timestamp = generate_timestamp
        accessor_secret = generate_accessor_secret
        request = retrieve_prepare_request(timestamp: timestamp, accessor_secret: accessor_secret, principal: principal)
        response = http_client.request(request)
        access_token =
          retrieve_handle_response(response: response, timestamp: timestamp, accessor_secret: accessor_secret)
        @access_token_cache&.put('cerner-oauth1a/access-tokens', cache_key, Cache::AccessTokenEntry.new(access_token))
        access_token
      end
def retrieve ( principal : nil , ignore_cache : false ) cache_key = "#{@consumer_key}&#{principal}" if @access_token_cache && ! ignore_cache cache_entry = @access_token_cache . get ( 'cerner-oauth1a/access-tokens' , cache_key ) return cache_entry . value if cache_entry end timestamp = generate_timestamp accessor_secret = generate_accessor_secret request = retrieve_prepare_request ( timestamp : timestamp , accessor_secret : accessor_secret , principal : principal ) response = http_client . request ( request ) access_token = retrieve_handle_response ( response : response , timestamp : timestamp , accessor_secret : accessor_secret ) @access_token_cache &. put ( 'cerner-oauth1a/access-tokens' , cache_key , Cache :: AccessTokenEntry . new ( access_token ) ) access_token end
Public: Retrieves an AccessToken from the configured Access Token service endpoint (#access_token_url).
Public : Retrieves an AccessToken from the configured Access Token service endpoint ( #access_token_url ) .
# generate token request info
principal
ignore_cache