Sha256: 51468f29fd667cbd73d483e4c606a35bed4e39f0a123eebc859e29a95c85f1ee

Contents?: true

Size: 913 Bytes

Versions: 4

Compression:

Stored size: 913 Bytes

Contents

module Kuroko2
  module Workflow
    module Notifier
      class Mail
        def initialize(job_instance)
          @job_instance = job_instance
          @definition   = job_instance.job_definition
        end

        def notify_working
          # do nothing
        end

        def notify_cancellation
          if @definition.notify_cancellation
            deliver_job_failure
          end
        end

        def notify_failure
          deliver_job_failure
        end

        def notify_critical
          deliver_job_failure
        end

        def notify_finished
          # do nothing
        end

        def notify_long_elapsed_time
          Kuroko2::Notifications.notify_long_elapsed_time(@job_instance).deliver_now
        end

        private

        def deliver_job_failure
          Kuroko2::Notifications.job_failure(@job_instance).deliver_now
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kuroko2-0.2.3 lib/autoload/kuroko2/workflow/notifier/mail.rb
kuroko2-0.2.2 lib/autoload/kuroko2/workflow/notifier/mail.rb
kuroko2-0.2.1 lib/kuroko2/workflow/notifier/mail.rb
kuroko2-0.2.0 lib/kuroko2/workflow/notifier/mail.rb