Exception: Handsoap::Fault

Inherits:
StandardError
  • Object
show all
Defined in:
lib/handsoap/service.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, reason, details) ⇒ Fault

Returns a new instance of Fault



29
30
31
32
33
# File 'lib/handsoap/service.rb', line 29

def initialize(code, reason, details)
  @code = code
  @reason = reason
  @details = details
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code



28
29
30
# File 'lib/handsoap/service.rb', line 28

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details



28
29
30
# File 'lib/handsoap/service.rb', line 28

def details
  @details
end

#reasonObject (readonly)

Returns the value of attribute reason



28
29
30
# File 'lib/handsoap/service.rb', line 28

def reason
  @reason
end

Class Method Details

.from_xml(node, options = { :namespace => nil }) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/handsoap/service.rb', line 37

def self.from_xml(node, options = { :namespace => nil })
  if not options[:namespace]
    raise "Missing option :namespace"
  end
  ns = { 'env' => options[:namespace] }
  fault_code = node.xpath('./env:Code/env:Value', ns).to_s
  unless fault_code
    fault_code = node.xpath('./faultcode', ns).to_s
  end
  reason = node.xpath('./env:Reason/env:Text[1]', ns).to_s
  unless reason
    reason = node.xpath('./faultstring', ns).to_s
  end
  details = node.xpath('./detail/*', ns)
  self.new(fault_code, reason, details)
end

Instance Method Details

#to_sObject



34
35
36
# File 'lib/handsoap/service.rb', line 34

def to_s
  "Handsoap::Fault { :code => '#{@code}', :reason => '#{@reason}' }"
end