Module: XMLRPC::Convert

Defined in:
lib/action_kit_api/connection.rb

Overview

This seems silly and dangerous right? Overwriting something in the ruby standard libraries? Well ActionKit is doing XMLRPC wrong. This is almost identical to the Ruby standard library version however it drops the type check on the faultCode and the faultString. The XMLRPC standard indicates that yes the faultCode has to be an integer and faultString has to be a string. ActionKit WILL RETURN A STRING AS THE faultCode.

References:

XMLRPC Spec:
  http://xmlrpc.scripting.com/spec.html
ActionKit (just an example, see second sentence under 'get'
  https://roboticdogs.actionkit.com/docs/manual/api/users.html?highlight=faultcode

Class Method Summary collapse

Class Method Details

.fault(hash) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/action_kit_api/connection.rb', line 21

def self.fault(hash)
  if hash.kind_of? Hash and hash.size == 2 and
    hash.has_key? "faultCode" and hash.has_key? "faultString"

    XMLRPC::FaultException.new(hash["faultCode"], hash["faultString"])
  else
    raise "wrong fault-structure: #{hash.inspect}"
  end
end