Class: UINotifications::Tasks::TaskBulkResume
- Inherits:
-
Base
- Object
- Base
- UINotifications::Tasks::TaskBulkResume
- Defined in:
- app/services/ui_notifications/tasks/task_bulk_resume.rb
Instance Method Summary collapse
- #audience ⇒ Object
- #blueprint ⇒ Object
- #create ⇒ Object
-
#initialize(task, resumed_length, failed_length, skipped_length) ⇒ TaskBulkResume
constructor
A new instance of TaskBulkResume.
- #message ⇒ Object
Constructor Details
#initialize(task, resumed_length, failed_length, skipped_length) ⇒ TaskBulkResume
Returns a new instance of TaskBulkResume.
4 5 6 7 8 9 |
# File 'app/services/ui_notifications/tasks/task_bulk_resume.rb', line 4 def initialize(task, resumed_length, failed_length, skipped_length) @subject = task @resumed_length = resumed_length @failed_length = failed_length @skipped_length = skipped_length end |
Instance Method Details
#audience ⇒ Object
22 23 24 |
# File 'app/services/ui_notifications/tasks/task_bulk_resume.rb', line 22 def audience Notification::AUDIENCE_USER end |
#blueprint ⇒ Object
33 34 35 |
# File 'app/services/ui_notifications/tasks/task_bulk_resume.rb', line 33 def blueprint @blueprint ||= NotificationBlueprint.find_by(name: 'tasks_bulk_resume') end |
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/ui_notifications/tasks/task_bulk_resume.rb', line 11 def create Notification.create!( initiator: initiator, audience: audience, subject: subject, notification_blueprint: blueprint, message: , notification_recipients: [NotificationRecipient.create({ :user => User.current })] ) end |
#message ⇒ Object
26 27 28 29 30 31 |
# File 'app/services/ui_notifications/tasks/task_bulk_resume.rb', line 26 def ('%{resumed} Tasks were resumed. %{failed} Tasks failed to resume. %{skipped} Tasks were skipped. ' % { resumed: @resumed_length, failed: @failed_length, skipped: @skipped_length }) end |