Class: BingAdsRubySdk::SoapClient

Inherits:
Object
  • Object
show all
Defined in:
lib/bing_ads_ruby_sdk/soap_client.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service_name:, version:, environment:, header:) ⇒ SoapClient

Returns a new instance of SoapClient.



10
11
12
13
14
15
16
17
# File 'lib/bing_ads_ruby_sdk/soap_client.rb', line 10

def initialize(service_name:, version:, environment:, header:)
  @header = header
  @lolsoap_parser, @concrete_abstract_mapping = cache(service_name) do
    ::BingAdsRubySdk::AugmentedParser.new(
      path_to_wsdl(version, environment, service_name)
    ).call
  end
end

Class Attribute Details

.cached_parsersObject (readonly)

Returns the value of attribute cached_parsers.



131
132
133
# File 'lib/bing_ads_ruby_sdk/soap_client.rb', line 131

def cached_parsers
  @cached_parsers
end

Instance Method Details

#call(operation_name, message = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bing_ads_ruby_sdk/soap_client.rb', line 19

def call(operation_name, message = {})
  request = lolsoap_client.request(operation_name)

  request.header do |h|
    header.content.each do |k, v|
      h.__send__(k, v)
    end
  end
  request.body do |node|
    insert_args(message, node)
  end

  BingAdsRubySdk.log(:debug) { format_xml(request.content) }

  response_body = BingAdsRubySdk::HttpClient.post(request)

  parse_response(request, response_body)
end

#wsdl_wrapper(operation_name) ⇒ Object



38
39
40
# File 'lib/bing_ads_ruby_sdk/soap_client.rb', line 38

def wsdl_wrapper(operation_name)
  WsdlOperationWrapper.new(lolsoap_parser, operation_name)
end