Exception: SOAP::MultiService::ApiError

Inherits:
Error
  • Object
show all
Defined in:
lib/soapex/error.rb

Overview

Raised if a call returns with a SOAP error

Instance Method Summary collapse

Constructor Details

#initialize(fault) ⇒ ApiError

Returns a new instance of ApiError.



30
31
32
33
34
35
36
37
38
# File 'lib/soapex/error.rb', line 30

def initialize(fault)
  @soap_faultcode = getOrNil(fault, 'faultcode')
  @soap_faultstring = getOrNil(fault, 'faultstring')
  @code = getOrNil(fault.detail, 'code')
  @internal = getOrNil(fault.detail,'internal')
  @message = getOrNil(fault.detail,'message')
  @trigger = getOrNil(fault.detail,'trigger')
  @violations = getOrNil(fault.detail,'violations')
end

Instance Method Details

#inspectObject



40
41
42
# File 'lib/soapex/error.rb', line 40

def inspect
  "#<SOAP::MultiService::ApiError: #{message}>"
end

#messageObject



44
45
46
47
48
# File 'lib/soapex/error.rb', line 44

def message
  Attrs.map{|a| [a, instance_variable_get(atsym(a))] }.
     select{|p| p[1] }.
        map{|p| "#{p[0]}: #{p[1].inspect}" }.join(', ')
end

#to_sObject



50
51
52
# File 'lib/soapex/error.rb', line 50

def to_s
  message
end