class UNotifier::Provider::User::ActionCable
Attributes
autohide_delay[RW]
channel_name[RW]
server[R]
Public Class Methods
new(server, channel_name: nil, autohide_delay: 30, notification_conditions: [])
click to toggle source
Calls superclass method
UNotifier::Provider::ProviderBase::new
# File lib/provider/user/action_cable.rb, line 8 def initialize(server, channel_name: nil, autohide_delay: 30, notification_conditions: []) super(notification_conditions: notification_conditions) @server = server @channel_name = channel_name @autohide_delay = autohide_delay end
Public Instance Methods
notify(notification)
click to toggle source
# File lib/provider/user/action_cable.rb, line 15 def notify(notification) return unless can_notify?(notification) server.broadcast channel_name.call(notification), serialize_notification(notification) end
sensitive?()
click to toggle source
# File lib/provider/user/action_cable.rb, line 21 def sensitive? false end
serialize_notification(notification)
click to toggle source
# File lib/provider/user/action_cable.rb, line 25 def serialize_notification(notification) { id: notification.id, title: notification.title, body: notification.body, autohide_delay: notification.autohide_delay || @autohide_delay, user_login: notification.target.login, link: notification.link, urgency: notification.urgency, } end