Module: IletiMerkezi::XmlBuilder

Included in:
Account, Authentication, Cancel, Report, Request, Sms
Defined in:
lib/ileti_merkezi/utils/xml_builder.rb

Overview

XmlBuilder

Constant Summary collapse

XML_TAG =
'<%<tag>s>%<content>s</%<tag>s>'

Instance Method Summary collapse

Instance Method Details

#hash_to_xml(hash) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/ileti_merkezi/utils/xml_builder.rb', line 8

def hash_to_xml(hash)
  hash.each_with_object([]) do |(key, value), tags|
    tags << case value
            when Hash then create_xml_tag(key, hash_to_xml(value))
            when Array then array_to_xml(key, value)
            else
              create_xml_tag(key, value)
            end
  end.flatten.join
end