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
active_shipping-1.9.1 lib/active_shipping/shipment_event.rb
active_shipping-1.9.0 lib/active_shipping/shipment_event.rb
active_shipping-1.8.6 lib/active_shipping/shipment_event.rb
active_shipping-1.8.5 lib/active_shipping/shipment_event.rb
active_shipping-1.8.4 lib/active_shipping/shipment_event.rb
active_shipping-1.8.3 lib/active_shipping/shipment_event.rb
active_shipping-1.8.2 lib/active_shipping/shipment_event.rb
active_shipping-1.8.1 lib/active_shipping/shipment_event.rb
active_shipping-1.8.0 lib/active_shipping/shipment_event.rb
active_shipping-1.7.3 lib/active_shipping/shipment_event.rb
active_shipping-1.7.2 lib/active_shipping/shipment_event.rb