Class: Savon::SOAP::Response
- Inherits:
-
Object
- Object
- Savon::SOAP::Response
- Defined in:
- lib/savon/soap/response.rb
Overview
Savon::SOAP::Response
Represents the SOAP response and contains the HTTP response.
Instance Attribute Summary collapse
-
#http ⇒ Object
Returns the value of attribute http.
Instance Method Summary collapse
-
#basic_hash ⇒ Object
Returns the complete SOAP response XML without normalization.
-
#header ⇒ Object
Returns the SOAP response header as a Hash.
-
#http_error ⇒ Object
Returns the
Savon::HTTP::Error
. -
#http_error? ⇒ Boolean
Returns whether there was an HTTP error.
-
#initialize(response) ⇒ Response
constructor
Expects an
HTTPI::Response
and handles errors. -
#soap_fault ⇒ Object
Returns the
Savon::SOAP::Fault
. -
#soap_fault? ⇒ Boolean
Returns whether there was a SOAP fault.
-
#success? ⇒ Boolean
Returns whether the request was successful.
-
#to_array(*path) ⇒ Object
Returns the SOAP response body as an Array.
-
#to_hash ⇒ Object
Returns the SOAP response body as a Hash.
-
#to_xml ⇒ Object
Returns the SOAP response XML.
Constructor Details
#initialize(response) ⇒ Response
Expects an HTTPI::Response
and handles errors.
14 15 16 17 |
# File 'lib/savon/soap/response.rb', line 14 def initialize(response) self.http = response raise_errors if Savon.raise_errors? end |
Instance Attribute Details
#http ⇒ Object
Returns the value of attribute http.
19 20 21 |
# File 'lib/savon/soap/response.rb', line 19 def http @http end |
Instance Method Details
#basic_hash ⇒ Object
Returns the complete SOAP response XML without normalization.
62 63 64 |
# File 'lib/savon/soap/response.rb', line 62 def basic_hash @basic_hash ||= Savon::SOAP::XML.parse http.body end |
#header ⇒ Object
Returns the SOAP response header as a Hash.
47 48 49 |
# File 'lib/savon/soap/response.rb', line 47 def header @header_hash ||= basic_hash.find_soap_header end |
#http_error ⇒ Object
Returns the Savon::HTTP::Error
.
42 43 44 |
# File 'lib/savon/soap/response.rb', line 42 def http_error @http_error ||= HTTP::Error.new http end |
#http_error? ⇒ Boolean
Returns whether there was an HTTP error.
37 38 39 |
# File 'lib/savon/soap/response.rb', line 37 def http_error? http_error.present? end |
#soap_fault ⇒ Object
Returns the Savon::SOAP::Fault
.
32 33 34 |
# File 'lib/savon/soap/response.rb', line 32 def soap_fault @soap_fault ||= Fault.new http end |
#soap_fault? ⇒ Boolean
Returns whether there was a SOAP fault.
27 28 29 |
# File 'lib/savon/soap/response.rb', line 27 def soap_fault? soap_fault.present? end |
#success? ⇒ Boolean
Returns whether the request was successful.
22 23 24 |
# File 'lib/savon/soap/response.rb', line 22 def success? !soap_fault? && !http_error? end |
#to_array(*path) ⇒ Object
Returns the SOAP response body as an Array.
57 58 59 |
# File 'lib/savon/soap/response.rb', line 57 def to_array(*path) Savon::SOAP::XML.to_array to_hash, *path end |
#to_hash ⇒ Object
Returns the SOAP response body as a Hash.
52 53 54 |
# File 'lib/savon/soap/response.rb', line 52 def to_hash @hash ||= Savon::SOAP::XML.to_hash basic_hash end |
#to_xml ⇒ Object
Returns the SOAP response XML.
67 68 69 |
# File 'lib/savon/soap/response.rb', line 67 def to_xml http.body end |