Class: Workarea::Orderbot::Product::ImportChildProducts

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
app/workers/workarea/orderbot/product/import_child_products.rb

Instance Method Summary collapse

Instance Method Details

#performObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/workers/workarea/orderbot/product/import_child_products.rb', line 7

def perform
  Orderbot::ProductImportData.child_products.each do |child_product|
    result = begin
      Workarea::Orderbot::ChildProduct.new(child_product).process
    rescue StandardError => e
      child_product.update_attributes!(error_message: e.message)
      false
    end

    if result
      child_product.delete
    end
  end
end