Class: Loco::Notification
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Loco::Notification
- Defined in:
- app/models/loco/notification.rb,
app/services/loco/notification/fetcher.rb
Defined Under Namespace
Classes: Fetcher
Instance Attribute Summary collapse
-
#obj ⇒ Object
Returns the value of attribute obj.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#obj ⇒ Object
Returns the value of attribute obj.
5 6 7 |
# File 'app/models/loco/notification.rb', line 5 def obj @obj end |
Class Method Details
.table_name_prefix ⇒ Object
15 16 17 |
# File 'app/models/loco/notification.rb', line 15 def table_name_prefix 'loco_' end |
Instance Method Details
#compact ⇒ Object
55 56 57 |
# File 'app/models/loco/notification.rb', line 55 def compact [obj_class, obj_id, event, data] end |
#prepare ⇒ Object
50 51 52 53 |
# File 'app/models/loco/notification.rb', line 50 def prepare set_event set_data end |
#recipient(opts = {}) ⇒ Object
43 44 45 46 47 48 |
# File 'app/models/loco/notification.rb', line 43 def recipient opts = {} return recipient_token if recipient_token return unless regular_recipient? return class_recipient unless recipient_id obj_recipient opts[:shallow] end |
#recipient=(val) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/models/loco/notification.rb', line 30 def recipient= val return if val.nil? return if val == :all if val.is_a? String self.recipient_token = val elsif val.instance_of? Class self.recipient_class = val.to_s else self.recipient_class = val.class.name self.recipient_id = val.id end end |