mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
17 lines
594 B
Ruby
17 lines
594 B
Ruby
class NotificationCenter
|
|
# send notification to one or several receiver with a type and attached object
|
|
def self.call(type: nil, receiver: nil, attached_object: nil)
|
|
if receiver.respond_to?(:each)
|
|
receiver.each do |user|
|
|
Notification.new.send_notification(type: type, attached_object: attached_object)
|
|
.to(user)
|
|
.deliver_later
|
|
end
|
|
else
|
|
Notification.new.send_notification(type: type, attached_object: attached_object)
|
|
.to(receiver)
|
|
.deliver_later
|
|
end
|
|
end
|
|
end
|