Handles the headers used in v2009 requests.
Methods
Class Public methods
Constructor for V2009HeaderHandler.
Args:
parent: AdWordsCredentials object containing the login credentials.
Source: show
# File lib/adwords4r/credentials.rb, line 40 40: def initialize(parent, namespace, version) 41: super(XSD::QName.new(namespace, 'RequestHeader')) 42: @parent = parent 43: @version = version 44: end
Instance Public methods
Handles callback.
Source: show
# File lib/adwords4r/credentials.rb, line 47 47: def on_simple_outbound 48: ns = HEADER_NAMESPACE 49: ns += 'v' if @version.is_a? Integer 50: ns += @version.to_s 51: header = SOAP::SOAPElement.new(nil) 52: auth_token = SOAP::SOAPElement.new(XSD::QName.new(ns, 'authToken'), 53: @parent.auth_token) 54: user_agent = SOAP::SOAPElement.new(XSD::QName.new(ns, 'userAgent'), 55: @parent.credentials['userAgent']) 56: dev_token = SOAP::SOAPElement.new(XSD::QName.new(ns, 'developerToken'), 57: @parent.credentials['developerToken']) 58: header.add(auth_token) 59: header.add(user_agent) 60: header.add(dev_token) 61: 62: if @parent.credentials['applicationToken'] 63: app_token = SOAP::SOAPElement.new(XSD::QName.new(ns, 64: 'applicationToken'), @parent.credentials['applicationToken']) 65: header.add(app_token) 66: end 67: 68: client_email_value = @parent.client_email 69: client_cid_value = @parent.client_customer_id 70: if client_email_value and client_email_value.length > 0 71: client_email = SOAP::SOAPElement.new(XSD::QName.new(ns, 'clientEmail'), 72: client_email_value) 73: header.add(client_email) 74: end 75: if client_cid_value and client_cid_value.length > 0 76: client_cid = SOAP::SOAPElement.new( 77: XSD::QName.new(ns, 'clientCustomerId'), client_cid_value) 78: header.add(client_cid) 79: end 80: if @parent.validate_only 81: validate_only = SOAP::SOAPElement.new( 82: XSD::QName.new(ns, 'validateOnly'), 'true') 83: header.add(validate_only) 84: end 85: return header 86: end