Sha256: 0c02ab5c084a53dbb21d2108ce3f81e905d7006b0282fae14e1e5489d6d20ac7

Contents?: true

Size: 567 Bytes

Versions: 98

Compression:

Stored size: 567 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.
          Spree::InventoryUnit.new(
            pending: true,
            line_item_id: line_item.id,
            variant_id: line_item.variant_id,
            quantity: line_item.quantity,
            order_id: @order.id
          )
        end
      end
    end
  end
end

Version data entries

98 entries across 98 versions & 1 rubygems

Version Path
spree_core-3.7.10 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.0.3 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.7.9 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.0.2 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.7.8 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.0.1 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.7.7 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.0.0 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.0.0.rc3 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.7.6 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.7.5 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.0.0.rc2 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.0.0.rc1 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.0.0.beta app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.7.4 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.7.3 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.7.2 app/models/spree/stock/inventory_unit_builder.rb
spree_core-3.7.1 app/models/spree/stock/inventory_unit_builder.rb