Class: Importo::ImportJob

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job
Defined in:
app/jobs/importo/import_job.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.execute_row(attributes, index, import_id, last_attempt, bid) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'app/jobs/importo/import_job.rb', line 27

def self.execute_row(attributes, index, import_id, last_attempt, bid)
  attributes = JSON.load(attributes).deep_symbolize_keys if attributes.is_a?(String)

  import = Import.find(import_id)
  record = import.importer.process_data_row(attributes, index, last_attempt: last_attempt)

  batch = Sidekiq::Batch.new(bid)

  if !import.completed? && import.can_complete? && batch.status.complete?
    ImportJobCallback.new.on_complete(batch.status, {import_id: import_id})
  end
end

Instance Method Details

#perform(attributes, index, import_id) ⇒ Object



23
24
25
# File 'app/jobs/importo/import_job.rb', line 23

def perform(attributes, index, import_id)
  self.class.execute_row(attributes, index, import_id, false, bid)
end