Class: AdWords::Pre2009HeaderHandler

Inherits:
SOAP::Header::SimpleHandler
  • Object
show all
Defined in:
lib/adwords4r/credentials.rb

Overview

Handles the headers used in <= v13 (both sandbox and production)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag, credentials) ⇒ Pre2009HeaderHandler

Constructor for Pre2009HeaderHandler.

Args:

  • tag: XML tag name to be handled (email, password, etc.)

  • value: value to be sent inside tag on outgoing requests



106
107
108
109
110
# File 'lib/adwords4r/credentials.rb', line 106

def initialize(tag, credentials)
  super(XSD::QName.new(nil, tag))
  @tag = tag
  @credentials = credentials
end

Instance Attribute Details

#credentials=(value) ⇒ Object (writeonly)

Sets the attribute credentials

Parameters:

  • value

    the value to set the attribute credentials to.



98
99
100
# File 'lib/adwords4r/credentials.rb', line 98

def credentials=(value)
  @credentials = value
end

#tagObject (readonly)

Returns the value of attribute tag.



97
98
99
# File 'lib/adwords4r/credentials.rb', line 97

def tag
  @tag
end

Instance Method Details

#on_simple_outboundObject

Handles callback.



113
114
115
116
117
118
119
120
121
# File 'lib/adwords4r/credentials.rb', line 113

def on_simple_outbound
  if @tag == 'clientEmail'
    return @credentials.client_email
  elsif @tag == 'clientCustomerId'
    return @credentials.client_customer_id
  else
    @credentials.credentials[@tag]
  end
end