Class: UINotifications::Tasks::TaskBulkStop
- Inherits:
-
Base
- Object
- Base
- UINotifications::Tasks::TaskBulkStop
- Defined in:
- app/services/ui_notifications/tasks/task_bulk_stop.rb
Instance Method Summary collapse
- #audience ⇒ Object
- #blueprint ⇒ Object
- #create ⇒ Object
-
#initialize(task, stopped_length, skipped_length) ⇒ TaskBulkStop
constructor
A new instance of TaskBulkStop.
- #message ⇒ Object
Constructor Details
#initialize(task, stopped_length, skipped_length) ⇒ TaskBulkStop
Returns a new instance of TaskBulkStop.
4 5 6 7 8 |
# File 'app/services/ui_notifications/tasks/task_bulk_stop.rb', line 4 def initialize(task, stopped_length, skipped_length) @subject = task @stopped_length = stopped_length @skipped_length = skipped_length end |
Instance Method Details
#audience ⇒ Object
21 22 23 |
# File 'app/services/ui_notifications/tasks/task_bulk_stop.rb', line 21 def audience Notification::AUDIENCE_GLOBAL end |
#blueprint ⇒ Object
31 32 33 |
# File 'app/services/ui_notifications/tasks/task_bulk_stop.rb', line 31 def blueprint @blueprint ||= NotificationBlueprint.find_by(name: 'tasks_bulk_stop') end |
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/ui_notifications/tasks/task_bulk_stop.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_stop.rb', line 25 def ('%{stopped} Tasks were stopped. %{skipped} Tasks were already stopped. ' % { stopped: @stopped_length, skipped: @skipped_length }) end |