Class: BingAdsRubySdk::WsdlOperationWrapper

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parser, operation_name) ⇒ WsdlOperationWrapper

Returns a new instance of WsdlOperationWrapper.



7
8
9
10
# File 'lib/bing_ads_ruby_sdk/wsdl_operation_wrapper.rb', line 7

def initialize(parser, operation_name)
  @parser = parser
  @request_namespace_type = parser.operations.fetch(operation_name).fetch(:input).fetch(:body).first
end

Instance Attribute Details

#request_namespace_typeObject (readonly)

Returns the value of attribute request_namespace_type.



5
6
7
# File 'lib/bing_ads_ruby_sdk/wsdl_operation_wrapper.rb', line 5

def request_namespace_type
  @request_namespace_type
end

Class Method Details

.prefix_and_name(wsdl, type_name) ⇒ Object



30
31
32
# File 'lib/bing_ads_ruby_sdk/wsdl_operation_wrapper.rb', line 30

def self.prefix_and_name(wsdl, type_name)
  wsdl.types.fetch(type_name).prefix_and_name
end

Instance Method Details

#base_type_name(elements, type_name) ⇒ Object



25
26
27
28
# File 'lib/bing_ads_ruby_sdk/wsdl_operation_wrapper.rb', line 25

def base_type_name(elements, type_name)
  return nil if type_name == BingAdsRubySdk.type_key
  elements.fetch(type_name).fetch(:base_type_name, type_name)
end

#namespace_and_type_from_name(all_attributes, type_name) ⇒ Object



21
22
23
# File 'lib/bing_ads_ruby_sdk/wsdl_operation_wrapper.rb', line 21

def namespace_and_type_from_name(all_attributes, type_name)
  all_attributes.fetch(type_name).fetch(:type)
end

#ordered_fields_hash(namespace_type) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/bing_ads_ruby_sdk/wsdl_operation_wrapper.rb', line 12

def ordered_fields_hash(namespace_type)
  # we check types first as its the main source of data, except for the Request type which lives in elements
  if parser.types.fetch(namespace_type, nil)
    parser.types.fetch(namespace_type).fetch(:elements)
  else
    parser.elements.fetch(namespace_type).fetch(:type).fetch(:elements)
  end
end