Class: AdwordsApi::ClientLoginHeaderHandler
- Inherits:
-
AdsCommon::SavonHeaders::SimpleHeaderHandler
- Object
- AdsCommon::SavonHeaders::SimpleHeaderHandler
- AdwordsApi::ClientLoginHeaderHandler
- Defined in:
- lib/adwords_api/client_login_header_handler.rb
Instance Method Summary collapse
-
#initialize(credential_handler, auth_handler, element_name, namespace, auth_namespace, version) ⇒ ClientLoginHeaderHandler
constructor
Initializes a header handler.
-
#prepare_request(request, soap, args) ⇒ Object
Enriches soap object with API-specific headers like namespaces, login credentials etc.
Constructor Details
#initialize(credential_handler, auth_handler, element_name, namespace, auth_namespace, version) ⇒ ClientLoginHeaderHandler
Initializes a header handler.
Args:
- credential_handler: a header with credential data
- auth_handler: a header with auth data
- element_name: an API-specific name of header element
- namespace: default namespace to use
- auth_namespace: namespace to use for auth headers
- version: services version
36 37 38 39 40 |
# File 'lib/adwords_api/client_login_header_handler.rb', line 36 def initialize(credential_handler, auth_handler, element_name, namespace, auth_namespace, version) super(credential_handler, auth_handler, element_name, namespace, version) @auth_namespace = auth_namespace end |
Instance Method Details
#prepare_request(request, soap, args) ⇒ Object
Enriches soap object with API-specific headers like namespaces, login credentials etc. Sets the default namespace for the body to the one specified in initializer.
Args:
- request: a HTTPI Request for extra configuration (unused)
- soap: a Savon soap object to fill fields in
- args: request parameters to adjust for namespaces
Returns:
- Modified soap structure
54 55 56 57 58 59 60 |
# File 'lib/adwords_api/client_login_header_handler.rb', line 54 def prepare_request(request, soap, args) super(request, soap, args) soap.header[:attributes!] ||= {} header_name = prepend_namespace(@element_name) soap.header[:attributes!][header_name] ||= {} soap.header[:attributes!][header_name]['xmlns'] = @auth_namespace end |