Sha256: 4b788d9dcf2f92a15681c3dfd445b410f8860a7da9e65ac6ebb873dd625a27c5
Contents?: true
Size: 695 Bytes
Versions: 2
Compression:
Stored size: 695 Bytes
Contents
module JobNotifier class Job < ActiveRecord::Base extend Enumerize STATUSES = [:pending, :finished, :failed] enumerize :status, in: STATUSES, default: :pending def self.update_feedback(job_id, data, status) job = JobNotifier::Job.find_by(job_id: job_id) return unless job job.update_attributes(result: data.to_s, status: status, notified: false) end def self.unnotified_by_identifier(encoded_identifier) JobNotifier::Job.where(identifier: encoded_identifier).where(notified: false) end def self.notify_by_identifier(encoded_identifier) unnotified_by_identifier(encoded_identifier).update_all(notified: true) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
job_notifier-1.5.0 | app/models/job_notifier/job.rb |
job_notifier-1.4.0 | app/models/job_notifier/job.rb |