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



162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/xml/libxml/xmlrpc/parser.rb', line 162

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[0][:faultCode].to_s + ": " + value[0][:faultString]
        when 'params'
            return Parser::ValueParser.parse(node.find('/methodResponse/params/param/value'))
        end
    end
end