Class: Bing::Ads::API::SOAPClient

Inherits:
Object
  • Object
show all
Defined in:
lib/bing/ads/api/soap_client.rb

Overview

Bing::Ads::API::SOAPClient

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ SOAPClient

Returns a new instance of SOAPClient.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bing/ads/api/soap_client.rb', line 10

def initialize(options)
  @customer_id            = options[:customer_id]
  @account_id             = options[:account_id]
  @developer_token        = options[:developer_token]
  @wsdl_url               = options[:wsdl_url]
  @namespace_identifier   = options[:namespace_identifier]
  @authentication_token   = options[:authentication_token]
  @username               = options[:username]
  @password               = options[:password]
  @client_settings        = options[:client_settings]
  @log_level              = options[:log_level] || :error
end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



6
7
8
# File 'lib/bing/ads/api/soap_client.rb', line 6

def 
  @account_id
end

#authentication_tokenObject

Returns the value of attribute authentication_token.



7
8
9
# File 'lib/bing/ads/api/soap_client.rb', line 7

def authentication_token
  @authentication_token
end

#client_settingsObject

Returns the value of attribute client_settings.



6
7
8
# File 'lib/bing/ads/api/soap_client.rb', line 6

def client_settings
  @client_settings
end

#customer_idObject

Returns the value of attribute customer_id.



6
7
8
# File 'lib/bing/ads/api/soap_client.rb', line 6

def customer_id
  @customer_id
end

#developer_tokenObject

Returns the value of attribute developer_token.



6
7
8
# File 'lib/bing/ads/api/soap_client.rb', line 6

def developer_token
  @developer_token
end

#namespace_identifierObject

Returns the value of attribute namespace_identifier.



7
8
9
# File 'lib/bing/ads/api/soap_client.rb', line 7

def namespace_identifier
  @namespace_identifier
end

#passwordObject

Returns the value of attribute password.



7
8
9
# File 'lib/bing/ads/api/soap_client.rb', line 7

def password
  @password
end

#savon_clientObject

Returns the value of attribute savon_client.



8
9
10
# File 'lib/bing/ads/api/soap_client.rb', line 8

def savon_client
  @savon_client
end

#usernameObject

Returns the value of attribute username.



7
8
9
# File 'lib/bing/ads/api/soap_client.rb', line 7

def username
  @username
end

#wsdl_urlObject

Returns the value of attribute wsdl_url.



6
7
8
# File 'lib/bing/ads/api/soap_client.rb', line 6

def wsdl_url
  @wsdl_url
end

Instance Method Details

#call(operation:, payload: {}) ⇒ Object



23
24
25
# File 'lib/bing/ads/api/soap_client.rb', line 23

def call(operation:, payload: {})
  client(client_settings).call(operation, message: payload)
end

#client(settings) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/bing/ads/api/soap_client.rb', line 27

def client(settings)
  return savon_client if savon_client
  settings = {
    convert_request_keys_to: :camelcase,
    wsdl: wsdl_url,
    namespace_identifier: namespace_identifier,
    soap_header: soap_header,
    log: true,
    log_level: @log_level,
    pretty_print_xml: true
  }
  settings.merge!(client_settings) if client_settings
  @savon_client = Savon.client(settings)
end