Exception: Savon::SOAP::Fault
- Defined in:
- lib/savon/soap/fault.rb
Overview
Savon::SOAP::Fault
Represents a SOAP fault. Contains the original HTTPI::Response
.
Instance Attribute Summary collapse
-
#http ⇒ Object
Accessor for the
HTTPI::Response
.
Instance Method Summary collapse
-
#initialize(http) ⇒ Fault
constructor
Expects an
HTTPI::Response
. -
#present? ⇒ Boolean
Returns whether a SOAP fault is present.
-
#to_hash ⇒ Object
Returns the SOAP response body as a Hash.
-
#to_s ⇒ Object
Returns the SOAP fault message.
Constructor Details
#initialize(http) ⇒ Fault
Expects an HTTPI::Response
.
13 14 15 |
# File 'lib/savon/soap/fault.rb', line 13 def initialize(http) self.http = http end |
Instance Attribute Details
#http ⇒ Object
Accessor for the HTTPI::Response
.
18 19 20 |
# File 'lib/savon/soap/fault.rb', line 18 def http @http end |
Instance Method Details
#present? ⇒ Boolean
Returns whether a SOAP fault is present.
21 22 23 |
# File 'lib/savon/soap/fault.rb', line 21 def present? @present ||= http.body.include?("Fault>") && (soap1_fault? || soap2_fault?) end |
#to_hash ⇒ Object
Returns the SOAP response body as a Hash.
32 33 34 |
# File 'lib/savon/soap/fault.rb', line 32 def to_hash @hash ||= Nori.parse(http.body)[:envelope][:body] end |
#to_s ⇒ Object
Returns the SOAP fault message.
26 27 28 29 |
# File 'lib/savon/soap/fault.rb', line 26 def to_s return "" unless present? @message ||= to_hash[:fault] end |