Class: ActiveShipping::TrackingResponse
- Defined in:
- lib/active_shipping/tracking_response.rb
Overview
Some carriers provide more information that others, so not all attributes will be set, depending on what carrier you are using.
Represents the response to a Carrier#find_tracking_info call.
Direct Known Subclasses
Instance Attribute Summary collapse
- #actual_delivery_date ⇒ Date, Time (also: #actual_delivery_time)
- #carrier ⇒ Symbol
- #carrier_name ⇒ String
- #delivery_signature ⇒ String
- #destination ⇒ ActiveShipping::Location
- #origin ⇒ ActiveShipping::Location
- #scheduled_delivery_date ⇒ Date, Time (also: #scheduled_delivery_time)
- #ship_time ⇒ Date, Time
- #shipment_events ⇒ Array<ActiveShipping::ShipmentEvent>
- #shipper_address ⇒ ActiveShipping::Location
- #status ⇒ Symbol
- #status_code ⇒ string
- #status_description ⇒ String
- #tracking_number ⇒ String
Attributes inherited from Response
#message, #params, #request, #test, #xml
Instance Method Summary collapse
-
#has_exception? ⇒ Boolean
(also: #exception?)
Returns
true
if something out of the ordinary has happened during the delivery of this package. -
#initialize(success, message, params = {}, options = {}) ⇒ TrackingResponse
constructor
A new instance of TrackingResponse.
-
#is_delivered? ⇒ Boolean
(also: #delivered?)
Returns
true
if something the shipment has arrived at the destination. -
#latest_event ⇒ ActiveShipping::ShipmentEvent
(also: #exception_event)
The latest tracking event for this shipment, i.e.
Methods inherited from Response
Constructor Details
#initialize(success, message, params = {}, options = {}) ⇒ TrackingResponse
Returns a new instance of TrackingResponse.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/active_shipping/tracking_response.rb', line 57 def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end |
Instance Attribute Details
#actual_delivery_date ⇒ Date, Time Also known as: actual_delivery_time
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#carrier ⇒ Symbol
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#carrier_name ⇒ String
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#delivery_signature ⇒ String
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#destination ⇒ ActiveShipping::Location
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#origin ⇒ ActiveShipping::Location
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#scheduled_delivery_date ⇒ Date, Time Also known as: scheduled_delivery_time
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#ship_time ⇒ Date, Time
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#shipment_events ⇒ Array<ActiveShipping::ShipmentEvent>
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#shipper_address ⇒ ActiveShipping::Location
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#status ⇒ Symbol
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#status_code ⇒ string
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#status_description ⇒ String
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
#tracking_number ⇒ String
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/active_shipping/tracking_response.rb', line 49 class TrackingResponse < Response attr_reader :carrier,:carrier_name, :status,:status_code, :status_description, :ship_time, :scheduled_delivery_date, :actual_delivery_date, :delivery_signature, :tracking_number, :shipment_events, :shipper_address, :origin, :destination # @params (see ActiveShipping::Response#initialize) def initialize(success, , params = {}, = {}) @carrier = [:carrier].parameterize.to_sym @carrier_name = [:carrier] @status = [:status] @status_code = [:status_code] @status_description = [:status_description] @ship_time = [:ship_time] @scheduled_delivery_date = [:scheduled_delivery_date] @actual_delivery_date = [:actual_delivery_date] @delivery_signature = [:delivery_signature] @tracking_number = [:tracking_number] @shipment_events = Array([:shipment_events]) @shipper_address = [:shipper_address] @origin = [:origin] @destination = [:destination] super end # The latest tracking event for this shipment, i.e. the current status. # @return [ActiveShipping::ShipmentEvent] def latest_event @shipment_events.last end # Returns `true` if something the shipment has arrived at the destination. # @return [Boolean] def is_delivered? @status == :delivered end # Returns `true` if something out of the ordinary has happened during # the delivery of this package. # @return [Boolean] def has_exception? @status == :exception end alias_method :exception_event, :latest_event alias_method :delivered?, :is_delivered? alias_method :exception?, :has_exception? alias_method :scheduled_delivery_time, :scheduled_delivery_date alias_method :actual_delivery_time, :actual_delivery_date end |
Instance Method Details
#has_exception? ⇒ Boolean Also known as: exception?
Returns true
if something out of the ordinary has happened during
the delivery of this package.
90 91 92 |
# File 'lib/active_shipping/tracking_response.rb', line 90 def has_exception? @status == :exception end |
#is_delivered? ⇒ Boolean Also known as: delivered?
Returns true
if something the shipment has arrived at the destination.
83 84 85 |
# File 'lib/active_shipping/tracking_response.rb', line 83 def is_delivered? @status == :delivered end |
#latest_event ⇒ ActiveShipping::ShipmentEvent Also known as: exception_event
The latest tracking event for this shipment, i.e. the current status.
77 78 79 |
# File 'lib/active_shipping/tracking_response.rb', line 77 def latest_event @shipment_events.last end |