class VantivLite::XML::REXML::Serializer
Public Instance Methods
call(hash)
click to toggle source
# File lib/vantiv_lite/xml/rexml.rb, line 32 def call(hash) # NOTE: This forces attributes to be delimited with double quotes. Despite the fact that # the Litle API returns single-quoted responses, requests with single-quoted attributes # will yield an internal server error. ::REXML::Document.new(nil, attribute_quote: :quote).tap do |d| d.add(::REXML::XMLDecl.new) add_xml_elements!(d, hash) end.to_s end
Private Instance Methods
attributes_or_elements!(parent, key, value)
click to toggle source
# File lib/vantiv_lite/xml/rexml.rb, line 44 def attributes_or_elements!(parent, key, value) return parent.add_attribute(key, text_with(value)) if attributes.include?(key) add_xml_elements!(::REXML::Element.new(key, parent, parent.context), value) end
insert_text!(element, text)
click to toggle source
# File lib/vantiv_lite/xml/rexml.rb, line 49 def insert_text!(element, text) element.add_text(text_with(text)) end