Sha256: cf01f35f5f4d915e140a1f4dc07833ef085ade6c611bd23d24ecf36bd656d72d

Contents?: true

Size: 559 Bytes

Versions: 31

Compression:

Stored size: 559 Bytes

Contents

module Spree
  module Stock
    class InventoryUnitBuilder
      def initialize(order)
        @order = order
      end

      def units
        @order.line_items.map do |line_item|
          # They go through multiple splits, avoid loading the
          # association to order until needed.
          InventoryUnit.new(
            pending:    true,
            line_item:  line_item,
            variant:    line_item.variant,
            quantity:   line_item.quantity,
            order_id:   @order.id
          )
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
spree_core-3.4.6 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.6.6 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.6.5 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.6.4 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.6.3 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.6.2 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.6.1 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.6.0 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.5.0 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.3.6 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.6.0.rc1 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.5.0.rc2 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.5.0.rc1 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.4.5 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.3.5 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.4.4 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.4.3 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.3.4 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.4.2 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.3.3 app/models/spree/stock/inventory_unit_builder.rb