Class: ActiveMerchant::Shipping::TrackingResponse
- Defined in:
- lib/active_shipping/shipping/tracking_response.rb
Instance Attribute Summary collapse
-
#carrier ⇒ Object
readonly
symbol.
-
#carrier_name ⇒ Object
readonly
string.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#scheduled_delivery_date ⇒ Object
readonly
time.
-
#shipment_events ⇒ Object
readonly
array of ShipmentEvents in chronological order.
-
#status ⇒ Object
readonly
symbol.
-
#status_code ⇒ Object
readonly
string.
-
#status_description ⇒ Object
readonly
string.
-
#tracking_number ⇒ Object
readonly
string.
Attributes inherited from Response
#message, #params, #request, #test, #xml
Instance Method Summary collapse
- #has_exception? ⇒ Boolean (also: #exception?)
-
#initialize(success, message, params = {}, options = {}) ⇒ TrackingResponse
constructor
A new instance of TrackingResponse.
- #is_delivered? ⇒ Boolean (also: #delivered?)
- #latest_event ⇒ Object (also: #exception_event)
Methods inherited from Response
Constructor Details
#initialize(success, message, params = {}, options = {}) ⇒ TrackingResponse
Returns a new instance of TrackingResponse.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 15 def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @scheduled_delivery_date = [:scheduled_delivery_date] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @origin, @destination = [:origin], [:destination] super end |
Instance Attribute Details
#carrier ⇒ Object (readonly)
symbol
5 6 7 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 5 def carrier @carrier end |
#carrier_name ⇒ Object (readonly)
string
6 7 8 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 6 def carrier_name @carrier_name end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
13 14 15 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 13 def destination @destination end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
13 14 15 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 13 def origin @origin end |
#scheduled_delivery_date ⇒ Object (readonly)
time
10 11 12 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 10 def scheduled_delivery_date @scheduled_delivery_date end |
#shipment_events ⇒ Object (readonly)
array of ShipmentEvents in chronological order
12 13 14 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 12 def shipment_events @shipment_events end |
#status ⇒ Object (readonly)
symbol
7 8 9 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 7 def status @status end |
#status_code ⇒ Object (readonly)
string
8 9 10 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 8 def status_code @status_code end |
#status_description ⇒ Object (readonly)
string
9 10 11 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 9 def status_description @status_description end |
#tracking_number ⇒ Object (readonly)
string
11 12 13 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 11 def tracking_number @tracking_number end |
Instance Method Details
#has_exception? ⇒ Boolean Also known as: exception?
36 37 38 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 36 def has_exception? @status == :exception end |
#is_delivered? ⇒ Boolean Also known as: delivered?
32 33 34 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 32 def is_delivered? @status == :delivered end |
#latest_event ⇒ Object Also known as: exception_event
28 29 30 |
# File 'lib/active_shipping/shipping/tracking_response.rb', line 28 def latest_event @shipment_events.last end |