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.4.27 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.4 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.26 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.3 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.25 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.2 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.24 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.1 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.23 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.22 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.0 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.21 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.5.0.beta.1 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.20 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.19 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.18 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.17 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.16 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.15 vendor/active_shipping/lib/active_shipping/shipment_event.rb
workarea-core-3.4.14 vendor/active_shipping/lib/active_shipping/shipment_event.rb