Class: IntegrationPal::Job

Inherits:
ApplicationRecord show all
Includes:
Statusable
Defined in:
app/models/integration_pal/job.rb

Constant Summary

Constants included from Statusable

Statusable::COMPLETED_STATUS, Statusable::FAILED_STATUS, Statusable::IN_PROGRESS_STATUS, Statusable::PENDING_STATUS, Statusable::STATUSES

Instance Method Summary collapse

Instance Method Details

#queue_jobObject



12
13
14
15
# File 'app/models/integration_pal/job.rb', line 12

def queue_job
  raise 'Cannot start a non persisted job' unless self.persisted?
  worker.job_class.perform_later(self.id)
end

#startObject



17
18
19
# File 'app/models/integration_pal/job.rb', line 17

def start
  self.update_attributes(status: IN_PROGRESS_STATUS, started_at: Time.zone.now, job_params: self.job_params.merge(worker.settings))
end