Class: EBay::RequesterCredentialsHandler

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

Constant Summary collapse

HeaderName =
XSD::QName.new('urn:ebay:apis:eBLBaseComponents', 'RequesterCredentials')
Credentials =
XSD::QName.new('urn:ebay:apis:eBLBaseComponents', 'Credentials')
EbayAuthToken =
XSD::QName.new(nil, 'n1:eBayAuthToken')
DevId =
XSD::QName.new(nil, 'n1:DevId')
AppId =
XSD::QName.new(nil, 'n1:AppId')
AuthCert =
XSD::QName.new(nil, 'n1:AuthCert')

Instance Method Summary collapse

Constructor Details

#initialize(eBayAuthToken, devId, appId, authCert) ⇒ RequesterCredentialsHandler

Returns a new instance of RequesterCredentialsHandler.



38
39
40
41
# File 'lib/RequesterCredentialsHandler.rb', line 38

def initialize(eBayAuthToken, devId, appId, authCert) 
  super(HeaderName) 
  @token, @devId, @appId, @cert = eBayAuthToken, devId, appId, authCert
end

Instance Method Details

#on_simple_outboundObject



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/RequesterCredentialsHandler.rb', line 43

def on_simple_outbound
  creds = { Credentials => { DevId => @devId, AppId => @appId, AuthCert => @cert } }
  
  # In a handful of calls mostly related to generating tokens in 
  # multiple-user applications (ex. GetSessionID), you don't want to pass
  # in a token (or an empty eBayAuthToken node) 'cuz you're still in the 
  # process of getting one.
  creds.merge!({ EbayAuthToken => @token }) unless @token.nil? || @token.empty?
  
  return creds
end