Sha256: 378e68e90ccf720dd016ac00c58970b016706d374669be9b7b84c32ca6bfa57c

Contents?: true

Size: 421 Bytes

Versions: 3

Compression:

Stored size: 421 Bytes

Contents

module Comable
  module Inventory
    class Unit
      attr_accessor :variant

      def initialize(variant)
        @variant = variant
      end

      def to_shipment_item(shipment)
        stock = find_stock_item(shipment)
        Comable::ShipmentItem.new(stock: stock)
      end

      private

      def find_stock_item(shipment)
        shipment.stock_location.find_stock_item(variant)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
comable-core-0.7.1 app/models/comable/inventory/unit.rb
comable-core-0.7.0 app/models/comable/inventory/unit.rb
comable-core-0.7.0.beta2 app/models/comable/inventory/unit.rb