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-4.10.1 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.10.0 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.9.0 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.8.3 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.8.2 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.7.3 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.6.6 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.5.5 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.0.9 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.1.15 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.2.7 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.3.3 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.4.1 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.5.4 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.6.5 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.7.2 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.7.1 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.6.4 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.7.0 app/models/spree/stock/inventory_unit_builder.rb
spree_core-4.6.3 app/models/spree/stock/inventory_unit_builder.rb