Class: Biovision::Notifiers::SocializationNotifier
- Inherits:
-
BaseNotifier
- Object
- BaseNotifier
- Biovision::Notifiers::SocializationNotifier
- Defined in:
- app/lib/biovision/notifiers/socialization_notifier.rb
Overview
Notification mapper for socialization component
Constant Summary collapse
- TYPE_FOLLOWER =
'follower'
- TYPE_MESSAGE =
'message'
Instance Attribute Summary
Attributes inherited from BaseNotifier
Instance Method Summary collapse
Methods inherited from BaseNotifier
[], #component, handler_class, #initialize, #notify, slug, #view
Constructor Details
This class inherits a constructor from Biovision::Notifiers::BaseNotifier
Instance Method Details
#entity ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/lib/biovision/notifiers/socialization_notifier.rb', line 10 def entity data = notification&.data.to_h case data['type'] when TYPE_MESSAGE, TYPE_FOLLOWER User.find_by(id: data['id']) else nil end end |
#new_follower(follower_id) ⇒ Object
26 27 28 |
# File 'app/lib/biovision/notifiers/socialization_notifier.rb', line 26 def new_follower(follower_id) check_and_notify(follower_id, TYPE_FOLLOWER) end |
#new_message(sender_id) ⇒ Object
21 22 23 |
# File 'app/lib/biovision/notifiers/socialization_notifier.rb', line 21 def (sender_id) check_and_notify(sender_id, TYPE_MESSAGE) end |