Class: Savon::Response
Overview
Savon::Response
Represents the HTTP and SOAP response.
Constant Summary collapse
- @@raise_errors =
The global setting of whether to raise errors.
true
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=(raise_errors) ⇒ Object
Sets the global setting of whether to raise errors.
-
.raise_errors? ⇒ Boolean
Returns the global setting 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.
22 23 24 25 26 27 |
# File 'lib/savon/response.rb', line 22 def initialize(response) @response = response handle_soap_fault handle_http_error end |
Instance Attribute Details
#http_error ⇒ Object (readonly)
Returns the HTTP error message.
43 44 45 |
# File 'lib/savon/response.rb', line 43 def http_error @http_error end |
#soap_fault ⇒ Object (readonly)
Returns the SOAP fault message.
35 36 37 |
# File 'lib/savon/response.rb', line 35 def soap_fault @soap_fault end |
Class Method Details
.raise_errors=(raise_errors) ⇒ Object
Sets the global setting of whether to raise errors.
12 13 14 |
# File 'lib/savon/response.rb', line 12 def self.raise_errors=(raise_errors) @@raise_errors = raise_errors end |
.raise_errors? ⇒ Boolean
Returns the global setting of whether to raise errors.
17 18 19 |
# File 'lib/savon/response.rb', line 17 def self.raise_errors? @@raise_errors end |
Instance Method Details
#http_error? ⇒ Boolean
Returns whether there was an HTTP error.
38 39 40 |
# File 'lib/savon/response.rb', line 38 def http_error? @http_error end |
#soap_fault? ⇒ Boolean
Returns whether there was a SOAP fault.
30 31 32 |
# File 'lib/savon/response.rb', line 30 def soap_fault? @soap_fault end |
#to_hash ⇒ Object
Returns the SOAP response as a Hash.
46 47 48 |
# File 'lib/savon/response.rb', line 46 def to_hash @body.find_regexp(/.+/).map_soap_response end |
#to_xml ⇒ Object Also known as: to_s
Returns the SOAP response XML.
51 52 53 |
# File 'lib/savon/response.rb', line 51 def to_xml @response.body end |