Module: XMLRPC::Convert

Defined in:
lib/softlayer/Service.rb

Overview

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

Class Method Summary collapse

Class Method Details

.fault(hash) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/softlayer/Service.rb', line 29

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