Class: Noticed::DeliveryMethods::Base
- Inherits:
-
Object
- Object
- Noticed::DeliveryMethods::Base
- Extended by:
- ActiveModel::Callbacks
- Defined in:
- lib/noticed/delivery_methods/base.rb
Instance Attribute Summary collapse
-
#notification ⇒ Object
readonly
Returns the value of attribute notification.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#recipient ⇒ Object
readonly
Returns the value of attribute recipient.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
Instance Attribute Details
#notification ⇒ Object (readonly)
Returns the value of attribute notification.
7 8 9 |
# File 'lib/noticed/delivery_methods/base.rb', line 7 def notification @notification end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/noticed/delivery_methods/base.rb', line 7 def @options end |
#recipient ⇒ Object (readonly)
Returns the value of attribute recipient.
7 8 9 |
# File 'lib/noticed/delivery_methods/base.rb', line 7 def recipient @recipient end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
7 8 9 |
# File 'lib/noticed/delivery_methods/base.rb', line 7 def record @record end |
Instance Method Details
#deliver ⇒ Object
24 25 26 |
# File 'lib/noticed/delivery_methods/base.rb', line 24 def deliver raise NotImplementedError, "Delivery methods must implement a deliver method" end |
#perform(notification_class:, options:, params:, recipient:, record:) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/noticed/delivery_methods/base.rb', line 9 def perform(notification_class:, options:, params:, recipient:, record:) @notification = notification_class.constantize.new(params) @options = @recipient = recipient @record = record # Make notification aware of database record and recipient during delivery @notification.record = record @notification.recipient = recipient run_callbacks :deliver do deliver end end |