Method: ActiveZuora::Base#build_xml

Defined in:
lib/active_zuora/base.rb

#build_xml(xml, soap, options = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/active_zuora/base.rb', line 34

def build_xml(xml, soap, options={})
  namespace = options.delete(:namespace) || self.namespace
  qualifier = soap.namespace_by_uri(namespace)
  custom_element_name = options.delete(:element_name)
  element_name = custom_element_name || zuora_object_name
  attributes = options.delete(:force_type) ? 
    { "xsi:type" => "#{qualifier}:#{zuora_object_name}" } : {}

  xml.tag!(qualifier, element_name.to_sym, attributes) do
    xml_field_names.map { |field_name| get_field!(field_name) }.sort(&method(:fields_order)).each do |field|
      field.build_xml(xml, soap, send(field.name), options)
    end
  end
end