Class: DfpApi::CredentialHandler
- Inherits:
-
AdsCommon::CredentialHandler
- Object
- AdsCommon::CredentialHandler
- DfpApi::CredentialHandler
- Defined in:
- lib/dfp_api/credential_handler.rb
Instance Method Summary collapse
-
#credentials(credentials_override = nil) ⇒ Object
Create the list of credentials to be used by the auth handler for header generation.
-
#generate_user_agent(extra_ids = []) ⇒ Object
Generates string to use as user agent in headers.
-
#identifier ⇒ Object
Returns the network code specified in the current credentials.
Instance Method Details
#credentials(credentials_override = nil) ⇒ Object
Create the list of credentials to be used by the auth handler for header generation.
31 32 33 34 35 36 37 38 39 |
# File 'lib/dfp_api/credential_handler.rb', line 31 def credentials(credentials_override = nil) result = super(credentials_override) validate_headers_for_server(result) result[:extra_headers] = { 'applicationName' => generate_user_agent(), 'networkCode' => result[:network_code] } return result end |
#generate_user_agent(extra_ids = []) ⇒ Object
Generates string to use as user agent in headers.
42 43 44 45 46 |
# File 'lib/dfp_api/credential_handler.rb', line 42 def generate_user_agent(extra_ids = []) agent_app = @config.read('authentication.application_name') extra_ids << ["DfpApi-Ruby/%s" % DfpApi::ApiConfig::CLIENT_LIB_VERSION] super(extra_ids, agent_app) end |
#identifier ⇒ Object
Returns the network code specified in the current credentials.
49 50 51 |
# File 'lib/dfp_api/credential_handler.rb', line 49 def identifier() return credentials[:extra_headers]['networkCode'] end |