Sha256: e07bdbbd10f473887ae31b294fa20909a03dbcba4a5a629375007960944f2383

Contents?: true

Size: 1.14 KB

Versions: 74

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

module Cron
  #
  # Base class for WeeklyJobs.
  #
  # Support running only on certain days as defined by day_of_week method
  #
  class Job < ApplicationJob
    cattr_accessor :cron_tab
    #
    # Method to set the cron_tab
    #
    def self.cron_tab_entry(entry)
      self.cron_tab = entry
    end

    #
    # Sends support an email if something goes awry
    #
    def send_support_email(error, event)
      email = EmailNotification.new
      email.to = 'support@app47.com'
      params = { current_date: I18n.l(Time.zone.today, format: :medium),
                 event: event,
                 error: error }
      email.from_template('support_ticket_notification', params)
      email.send_notification
    end

    #
    # Sends support a notification if something goes awry
    #
    def notify_job_failure(error, event)
      message = { job_name: self.class.to_s.titleize,
                  event: event,
                  error_message: error.message,
                  stack_trace: error.backtrace }
      SlackNotification.say message, to: SystemConfiguration.slack_support_channel, template: :job_failure
    end
  end
end

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
web47core-3.2.20 lib/app/jobs/cron/job.rb
web47core-3.2.19 lib/app/jobs/cron/job.rb
web47core-3.2.18 lib/app/jobs/cron/job.rb
web47core-3.2.17 lib/app/jobs/cron/job.rb
web47core-3.2.16 lib/app/jobs/cron/job.rb
web47core-3.2.15 lib/app/jobs/cron/job.rb
web47core-3.2.14 lib/app/jobs/cron/job.rb
web47core-3.2.13 lib/app/jobs/cron/job.rb
web47core-3.2.12 lib/app/jobs/cron/job.rb
web47core-3.2.9 lib/app/jobs/cron/job.rb
web47core-3.2.8 lib/app/jobs/cron/job.rb
web47core-3.2.7 lib/app/jobs/cron/job.rb
web47core-3.2.6 lib/app/jobs/cron/job.rb
web47core-3.2.5 lib/app/jobs/cron/job.rb
web47core-3.2.4 lib/app/jobs/cron/job.rb
web47core-2.2.20 lib/app/jobs/cron/job.rb
web47core-2.2.19 lib/app/jobs/cron/job.rb
web47core-3.2.3 lib/app/jobs/cron/job.rb
web47core-3.2.2 lib/app/jobs/cron/job.rb
web47core-2.2.15 lib/app/jobs/cron/job.rb