Class: ESM::Event::SendXm8Notification
- Inherits:
-
Object
- Object
- ESM::Event::SendXm8Notification
- Defined in:
- lib/esm/event/send_xm8_notification.rb,
lib/esm/event/send_xm8_notification/notification_manager.rb
Defined Under Namespace
Classes: NotificationManager
Instance Attribute Summary collapse
-
#community ⇒ Object
readonly
Returns the value of attribute community.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(server, message) ⇒ SendXm8Notification
constructor
A new instance of SendXm8Notification.
- #run! ⇒ Object
Constructor Details
#initialize(server, message) ⇒ SendXm8Notification
Returns a new instance of SendXm8Notification.
20 21 22 23 24 |
# File 'lib/esm/event/send_xm8_notification.rb', line 20 def initialize(server, ) @server = server @community = server.community @message = end |
Instance Attribute Details
#community ⇒ Object (readonly)
Returns the value of attribute community.
18 19 20 |
# File 'lib/esm/event/send_xm8_notification.rb', line 18 def community @community end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
18 19 20 |
# File 'lib/esm/event/send_xm8_notification.rb', line 18 def @message end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
18 19 20 |
# File 'lib/esm/event/send_xm8_notification.rb', line 18 def server @server end |
Class Method Details
.notification_manager ⇒ Object
6 7 8 |
# File 'lib/esm/event/send_xm8_notification.rb', line 6 def self.notification_manager @notification_manager ||= NotificationManager.new end |
.send_notifications(notifications) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/esm/event/send_xm8_notification.rb', line 10 def self.send_notifications(notifications) if notifications.any? { |n| !n.is_a?(Xm8Notification) } raise TypeError, "Invalid notifications provided: #{notifications}" end notification_manager.add(notifications) end |
Instance Method Details
#run! ⇒ Object
26 27 28 29 30 31 |
# File 'lib/esm/event/send_xm8_notification.rb', line 26 def run! notifications = filter_notifications return if notifications.blank? self.class.send_notifications(notifications) end |