Class: ActiveShipping::TrackingResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/active_shipping/tracking_response.rb

Overview

Note:

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

CPPWSTrackingResponse

Instance Attribute Summary collapse

Attributes inherited from Response

#message, #params, #request, #test, #xml

Instance Method Summary collapse

Methods inherited from Response

#success?, #test?

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, message, params = {}, options = {})
  @carrier = options[:carrier].parameterize.to_sym
  @carrier_name = options[:carrier]
  @status = options[:status]
  @status_code = options[:status_code]
  @status_description = options[:status_description]
  @ship_time = options[:ship_time]
  @scheduled_delivery_date = options[:scheduled_delivery_date]
  @actual_delivery_date = options[:actual_delivery_date]
  @delivery_signature = options[:delivery_signature]
  @tracking_number = options[:tracking_number]
  @shipment_events = Array(options[:shipment_events])
  @shipper_address = options[:shipper_address]
  @origin = options[:origin]
  @destination = options[:destination]
  super
end

Instance Attribute Details

#actual_delivery_dateDate, Time Also known as: actual_delivery_time

Returns:

  • (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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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

#carrierSymbol

Returns:

  • (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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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_nameString

Returns:

  • (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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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_signatureString

Returns:

  • (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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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

#destinationActiveShipping::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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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

#originActiveShipping::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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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_dateDate, Time Also known as: scheduled_delivery_time

Returns:

  • (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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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_timeDate, Time

Returns:

  • (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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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_eventsArray<ActiveShipping::ShipmentEvent>

Returns:



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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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_addressActiveShipping::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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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

#statusSymbol

Returns:

  • (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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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_codestring

Returns:

  • (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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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_descriptionString

Returns:

  • (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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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_numberString

Returns:

  • (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, message, params = {}, options = {})
    @carrier = options[:carrier].parameterize.to_sym
    @carrier_name = options[:carrier]
    @status = options[:status]
    @status_code = options[:status_code]
    @status_description = options[:status_description]
    @ship_time = options[:ship_time]
    @scheduled_delivery_date = options[:scheduled_delivery_date]
    @actual_delivery_date = options[:actual_delivery_date]
    @delivery_signature = options[:delivery_signature]
    @tracking_number = options[:tracking_number]
    @shipment_events = Array(options[:shipment_events])
    @shipper_address = options[:shipper_address]
    @origin = options[:origin]
    @destination = options[: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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


83
84
85
# File 'lib/active_shipping/tracking_response.rb', line 83

def is_delivered?
  @status == :delivered
end

#latest_eventActiveShipping::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