Method: CoreLibrary::XmlHelper.serialize_to_xml

Defined in:
lib/apimatic-core/utilities/xml_helper.rb

.serialize_to_xml(root_element_name, value, datetime_format: nil) ⇒ Object

Serializes the provided value to XML.

Parameters:

  • root_element_name (String)

    Root element for the XML provided.

  • value (String)

    Value to convert to XML.

  • datetime_format (CoreLibrary::DateTimeFormat) (defaults to: nil)

    The format to convert the date time into.



11
12
13
14
15
16
# File 'lib/apimatic-core/utilities/xml_helper.rb', line 11

def serialize_to_xml(root_element_name, value, datetime_format: nil)
  doc = Nokogiri::XML::Document.new
  add_as_subelement(doc, doc, root_element_name, value,
                    datetime_format: datetime_format)
  doc.to_xml
end