Sha256: d06ea4ccd116d3f1d82962ce33d52659c3d0eff0d4d4bb7f6deeab7b485fd83a

Contents?: true

Size: 597 Bytes

Versions: 91

Compression:

Stored size: 597 Bytes

Contents

module ActiveShipping
  class ShipmentEvent
    attr_reader :name, :time, :location, :message, :type_code

    def initialize(name, time, location, message = nil, type_code = nil)
      @name, @time, @location, @message, @type_code = name, time, location, message, type_code
    end

    def delivered?
      status == :delivered
    end

    def status
      @status ||= name.downcase.gsub("\s", "_").to_sym
    end

    def ==(other)
      attributes = %i(name time location message type_code)
      attributes.all? { |attr| self.public_send(attr) == other.public_send(attr) }
    end
  end
end

Version data entries

91 entries across 91 versions & 2 rubygems

Version Path
workarea-core-3.5.27 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.26 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.45 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.25 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.23 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.44 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.22 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.43 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.21 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.42 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.20 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.41 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.19 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.40 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.18 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.39 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.17 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.38 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.16 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.37 vendor/active_shipping/lib/active_shipping/shipment_event.rb