Class: XML::XMLRPC::Parser::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/xml/libxml/xmlrpc/parser.rb

Overview

Parse a methodResponse

Class Method Summary collapse

Class Method Details

.parse(node) ⇒ Object



169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/xml/libxml/xmlrpc/parser.rb', line 169

def self.parse(node)
    node.each_child do |child_node|
        case child_node.name.downcase
        when 'fault'
            # RPC call has returned an error - find the fault and GTFO
            value = Parser::ValueParser.parse(node.find('/methodResponse/fault/value'))
            raise RemoteCallError, value.to_a[0][:faultCode].to_s + ": " + value[0][:faultString]
        when 'params'
            return Parser::ValueParser.parse(node.find('/methodResponse/params/param/value'))
        end
    end
end