Class: SpreeCmCommissioner::InventoryItemSyncer
- Inherits:
-
BaseInteractor
- Object
- BaseInteractor
- SpreeCmCommissioner::InventoryItemSyncer
- Defined in:
- app/interactors/spree_cm_commissioner/inventory_item_syncer.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'app/interactors/spree_cm_commissioner/inventory_item_syncer.rb', line 6 def call ActiveRecord::Base.transaction do inventory_items.each do |inventory_item| quantity = inventory_id_and_quantities.find { |item| item[:inventory_id] == inventory_item.id }&.dig(:quantity) || 0 adjust_quantity_available(inventory_item, quantity) end end end |