Class: AuctionInc::Shipping::Response
- Inherits:
-
Object
- Object
- AuctionInc::Shipping::Response
- Defined in:
- lib/auction_inc/shipping/response.rb
Instance Attribute Summary collapse
-
#parsed ⇒ Object
Returns the value of attribute parsed.
-
#raw ⇒ Object
Returns the value of attribute raw.
Instance Method Summary collapse
- #body ⇒ Object
- #error ⇒ Object
- #has_error? ⇒ Boolean (also: #has_errors?)
-
#initialize(xml_string) ⇒ Response
constructor
A new instance of Response.
- #ship_rates ⇒ Object
Constructor Details
#initialize(xml_string) ⇒ Response
Returns a new instance of Response.
6 7 8 9 |
# File 'lib/auction_inc/shipping/response.rb', line 6 def initialize(xml_string) self.raw = xml_string self.parsed = Envelope.from_xml(self.raw) end |
Instance Attribute Details
#parsed ⇒ Object
Returns the value of attribute parsed.
4 5 6 |
# File 'lib/auction_inc/shipping/response.rb', line 4 def parsed @parsed end |
#raw ⇒ Object
Returns the value of attribute raw.
4 5 6 |
# File 'lib/auction_inc/shipping/response.rb', line 4 def raw @raw end |
Instance Method Details
#body ⇒ Object
11 12 13 |
# File 'lib/auction_inc/shipping/response.rb', line 11 def body self.parsed.body end |
#error ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/auction_inc/shipping/response.rb', line 20 def error if self.body.error.present? self.body.error elsif self.body.item_ship_rate.present? && self.body.item_ship_rate.has_errors? self.body.item_ship_rate.error else nil end end |
#has_error? ⇒ Boolean Also known as: has_errors?
15 16 17 |
# File 'lib/auction_inc/shipping/response.rb', line 15 def has_error? self.body.error.present? || (self.body.item_ship_rate.present? && self.body.item_ship_rate.has_errors?) end |
#ship_rates ⇒ Object
30 31 32 |
# File 'lib/auction_inc/shipping/response.rb', line 30 def ship_rates self.parsed.body.item_ship_rate.ship_rates if self.body.item_ship_rate.present? end |