Class: Shippinglogic::UPS::ShipAccept::Details
- Inherits:
-
Object
- Object
- Shippinglogic::UPS::ShipAccept::Details
- Defined in:
- lib/shippinglogic/ups/ship_accept.rb
Defined Under Namespace
Classes: Shipment
Instance Attribute Summary collapse
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#rate ⇒ Object
Returns the value of attribute rate.
-
#shipments ⇒ Object
Returns the value of attribute shipments.
Instance Method Summary collapse
-
#initialize(response) ⇒ Details
constructor
A new instance of Details.
Constructor Details
#initialize(response) ⇒ Details
Returns a new instance of Details.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/shippinglogic/ups/ship_accept.rb', line 15 def initialize(response) details = response[:shipment_results] charges = details[:shipment_charges][:total_charges] self.rate = BigDecimal.new(charges[:monetary_value]) self.currency = charges[:currency_code] self.shipments = [*details[:package_results]].collect do |package| shipment = Shipment.new shipment.tracking_number = package[:tracking_number] shipment.label = Base64.decode64(package[:label_image][:graphic_image]) shipment end end |
Instance Attribute Details
#currency ⇒ Object
Returns the value of attribute currency.
13 14 15 |
# File 'lib/shippinglogic/ups/ship_accept.rb', line 13 def currency @currency end |
#rate ⇒ Object
Returns the value of attribute rate.
13 14 15 |
# File 'lib/shippinglogic/ups/ship_accept.rb', line 13 def rate @rate end |
#shipments ⇒ Object
Returns the value of attribute shipments.
13 14 15 |
# File 'lib/shippinglogic/ups/ship_accept.rb', line 13 def shipments @shipments end |