Class: UINotifications::RemoteExecutionJobs::BaseJobFinish
- Inherits:
-
Base
- Object
- Base
- UINotifications::RemoteExecutionJobs::BaseJobFinish
- Defined in:
- app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb
Instance Method Summary collapse
- #blueprint ⇒ Object
- #deliver! ⇒ Object
-
#initialize(job_invocation) ⇒ BaseJobFinish
constructor
A new instance of BaseJobFinish.
- #initiator ⇒ Object
- #message ⇒ Object
Constructor Details
#initialize(job_invocation) ⇒ BaseJobFinish
Returns a new instance of BaseJobFinish.
4 5 6 |
# File 'app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb', line 4 def initialize(job_invocation) @subject = job_invocation end |
Instance Method Details
#blueprint ⇒ Object
22 23 24 25 |
# File 'app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb', line 22 def blueprint blueprint = @subject.status == HostStatus::ExecutionStatus::ERROR ? 'rex_job_failed' : 'rex_job_succeeded' @blueprint ||= NotificationBlueprint.unscoped.find_by(:name => blueprint) end |
#deliver! ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb', line 8 def deliver! ::Notification.create!( :audience => Notification::AUDIENCE_USER, :notification_blueprint => blueprint, :initiator => initiator, :message => , :subject => subject ) end |
#initiator ⇒ Object
18 19 20 |
# File 'app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb', line 18 def initiator User.anonymous_admin end |
#message ⇒ Object
27 28 29 |
# File 'app/services/ui_notifications/remote_execution_jobs/base_job_finish.rb', line 27 def UINotifications::StringParser.new(blueprint., { subject: subject }) end |