Class: KewegoParty::ParseXml

Inherits:
HTTParty::Parser
  • Object
show all
Defined in:
lib/kewego_party/parse_xml.rb

Instance Method Summary collapse

Instance Method Details

#parseObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/kewego_party/parse_xml.rb', line 6

def parse
  xml_parsed = ::MultiXml.parse(body)

  case xml_parsed
    when Hash
      ::Hashie::Rash.new(xml_parsed)
    when Array
      xml_parsed.map { |item| item.is_a?(Hash) ? ::Hashie::Rash.new(item) : item }
    else
      xml_parsed
  end
end