Class: SmsNotify::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/sms_notify/response.rb

Overview

Handles parsing a CDYNE SmsNotify! XML response into a Ruby-like hash.

Class Method Summary collapse

Class Method Details

.parse(response) ⇒ Object

Converts XML into a Ruby-like hash



8
9
10
11
12
13
14
15
16
# File 'lib/sms_notify/response.rb', line 8

def parse(response)
  if response.is_a?(SOAP::Mapping::Object)
     soap_response = SoapResponse.new(response)
     soap_response.to_hash
  else
    parser = XmlSimple.new({'ForceArray' => false, 'KeepRoot' => true, 'SuppressEmpty' => nil})
    parser.xml_in(response)
  end
end