Class: Notifi::Subscription
- Inherits:
-
Object
- Object
- Notifi::Subscription
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- lib/notifi/subscription.rb
Instance Method Summary collapse
- #notification_class(event) ⇒ Object
- #notify(event = :default, notifier: nil, set: {}) ⇒ Object
- #subscribable_options ⇒ Object
Instance Method Details
#notification_class(event) ⇒ Object
28 29 30 |
# File 'lib/notifi/subscription.rb', line 28 def notification_class(event) [event] || [:default] || Notification end |
#notify(event = :default, notifier: nil, set: {}) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/notifi/subscription.rb', line 10 def notify(event=:default, notifier: nil, set: {}) # TODO I wanted to do this in the subscribable notify method so you could # still forceably notifiy the notifier, but for the life of me I couldn't # get it to work. if notifier != self.subscriber set[:subscription] = self set[:notifier] = notifier set[:subscriber] = self.subscriber set[:subscribable] = self.subscribable self.notification_class(event).create(set) end end |
#subscribable_options ⇒ Object
24 25 26 |
# File 'lib/notifi/subscription.rb', line 24 def self.subscribable. end |