module XMLRPC::Convert

The XML-RPC spec calls for the “faultCode” in faults to be an integer but the SoftLayer XML-RPC API can return strings as the “faultCode”

We monkey patch the module method XMLRPC::FaultException::Convert::fault so that it does pretty much what the default does without checking to ensure that the faultCode is an integer

Public Class Methods

fault(hash) click to toggle source
Calls superclass method
# File lib/softlayer/Service.rb, line 31
def self.fault(hash)
  if hash.kind_of? Hash and hash.size == 2 and
    hash.has_key? "faultCode" and hash.has_key? "faultString" and
    (hash['faultCode'].kind_of?(Integer) || hash['faultCode'].kind_of?(String)) and hash['faultString'].kind_of? String

    XMLRPC::FaultException.new(hash['faultCode'], hash['faultString'])
  else
    super
  end
end