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



111
112
113
114
115
# File 'lib/adwords4r/credentials.rb', line 111

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:

  • the value to set the attribute credentials to.



103
104
105
# File 'lib/adwords4r/credentials.rb', line 103

def credentials=(value)
  @credentials = value
end

#tagObject (readonly)

Returns the value of attribute tag.



102
103
104
# File 'lib/adwords4r/credentials.rb', line 102

def tag
  @tag
end

Instance Method Details

#on_simple_outboundObject

Handles callback.



118
119
120
121
122
123
124
125
126
# File 'lib/adwords4r/credentials.rb', line 118

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