Class: SimpleShipping::Abstract::Response
- Inherits:
-
Object
- Object
- SimpleShipping::Abstract::Response
- Defined in:
- lib/simple_shipping/abstract/response.rb
Overview
Represents a response returned by the remote service for a request initiated by client.
An abstract class which provides a common interface. In the real world, you will deal with its subclasses:
Example:
response = client.request(shipper, recipient, package)
response.response # => #<Savon::SOAP::Response ...>
Direct Known Subclasses
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(savon_resp = nil) ⇒ Response
constructor
A new instance of Response.
-
#value_of(*path) ⇒ Object
Fetch the value of an XML attribute at the path specified as an array.
Constructor Details
#initialize(savon_resp = nil) ⇒ Response
Returns a new instance of Response.
16 17 18 |
# File 'lib/simple_shipping/abstract/response.rb', line 16 def initialize(savon_resp = nil) @response = savon_resp end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
14 15 16 |
# File 'lib/simple_shipping/abstract/response.rb', line 14 def response @response end |
Instance Method Details
#value_of(*path) ⇒ Object
Fetch the value of an XML attribute at the path specified as an array. of node names
22 23 24 |
# File 'lib/simple_shipping/abstract/response.rb', line 22 def value_of(*path) @response.to_array(*path).first end |