Class: Savon::Response
Overview
Savon::Response
Represents the HTTP and SOAP response.
Class Attribute Summary collapse
-
.raise_errors ⇒ Object
writeonly
Sets the default of whether to raise errors.
Instance Attribute Summary collapse
-
#http_error ⇒ Object
readonly
Returns the HTTP error message.
-
#soap_fault ⇒ Object
readonly
Returns the SOAP fault message.
Class Method Summary collapse
-
.raise_errors? ⇒ Boolean
Returns the default of whether to raise errors.
Instance Method Summary collapse
-
#http_error? ⇒ Boolean
Returns whether there was an HTTP error.
-
#initialize(response) ⇒ Response
constructor
Expects a Net::HTTPResponse and handles errors.
-
#soap_fault? ⇒ Boolean
Returns whether there was a SOAP fault.
-
#to_hash ⇒ Object
Returns the SOAP response as a Hash.
-
#to_xml ⇒ Object
(also: #to_s)
Returns the SOAP response XML.
Constructor Details
#initialize(response) ⇒ Response
Expects a Net::HTTPResponse and handles errors.
24 25 26 27 28 29 |
# File 'lib/savon/response.rb', line 24 def initialize(response) @response = response handle_soap_fault handle_http_error end |
Class Attribute Details
.raise_errors=(value) ⇒ Object (writeonly)
Sets the default of whether to raise errors.
14 15 16 |
# File 'lib/savon/response.rb', line 14 def raise_errors=(value) @raise_errors = value end |
Instance Attribute Details
#http_error ⇒ Object (readonly)
Returns the HTTP error message.
45 46 47 |
# File 'lib/savon/response.rb', line 45 def http_error @http_error end |
#soap_fault ⇒ Object (readonly)
Returns the SOAP fault message.
37 38 39 |
# File 'lib/savon/response.rb', line 37 def soap_fault @soap_fault end |
Class Method Details
.raise_errors? ⇒ Boolean
Returns the default of whether to raise errors.
17 18 19 |
# File 'lib/savon/response.rb', line 17 def raise_errors? @raise_errors end |
Instance Method Details
#http_error? ⇒ Boolean
Returns whether there was an HTTP error.
40 41 42 |
# File 'lib/savon/response.rb', line 40 def http_error? @http_error end |
#soap_fault? ⇒ Boolean
Returns whether there was a SOAP fault.
32 33 34 |
# File 'lib/savon/response.rb', line 32 def soap_fault? @soap_fault end |
#to_hash ⇒ Object
Returns the SOAP response as a Hash.
48 49 50 |
# File 'lib/savon/response.rb', line 48 def to_hash @body.find_regexp(/.+/).map_soap_response end |
#to_xml ⇒ Object Also known as: to_s
Returns the SOAP response XML.
53 54 55 |
# File 'lib/savon/response.rb', line 53 def to_xml @response.body end |