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.



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

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.



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

def request_namespace_type
  @request_namespace_type
end

Class Method Details

.prefix_and_name(wsdl, type_name) ⇒ Object



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

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



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

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



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

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

#ordered_fields_hash(namespace_type) ⇒ Object



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

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