Class: UINotifications::Tasks::TaskBulkCancel
- Inherits:
-
Base
- Object
- Base
- UINotifications::Tasks::TaskBulkCancel
- Defined in:
- app/services/ui_notifications/tasks/task_bulk_cancel.rb
Instance Method Summary collapse
- #audience ⇒ Object
- #blueprint ⇒ Object
- #create ⇒ Object
-
#initialize(task, cancelled_length, skipped_length) ⇒ TaskBulkCancel
constructor
A new instance of TaskBulkCancel.
- #message ⇒ Object
Constructor Details
#initialize(task, cancelled_length, skipped_length) ⇒ TaskBulkCancel
Returns a new instance of TaskBulkCancel.
4 5 6 7 8 |
# File 'app/services/ui_notifications/tasks/task_bulk_cancel.rb', line 4 def initialize(task, cancelled_length, skipped_length) @subject = task @cancelled_length = cancelled_length @skipped_length = skipped_length end |
Instance Method Details
#audience ⇒ Object
21 22 23 |
# File 'app/services/ui_notifications/tasks/task_bulk_cancel.rb', line 21 def audience Notification::AUDIENCE_GLOBAL end |
#blueprint ⇒ Object
31 32 33 |
# File 'app/services/ui_notifications/tasks/task_bulk_cancel.rb', line 31 def blueprint @blueprint ||= NotificationBlueprint.find_by(name: 'tasks_bulk_cancel') end |
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/ui_notifications/tasks/task_bulk_cancel.rb', line 10 def create Notification.create!( initiator: initiator, audience: audience, subject: subject, notification_blueprint: blueprint, message: , notification_recipients: [NotificationRecipient.create({ :user => User.current })] ) end |
#message ⇒ Object
25 26 27 28 29 |
# File 'app/services/ui_notifications/tasks/task_bulk_cancel.rb', line 25 def ('%{cancelled} Tasks were cancelled. %{skipped} Tasks were skipped. ' % { cancelled: @cancelled_length, skipped: @skipped_length }) end |