Class: Notifiable::NotifierBase
- Inherits:
-
Object
- Object
- Notifiable::NotifierBase
- Defined in:
- lib/notifiable/notifier_base.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#localized_notifications ⇒ Object
readonly
Returns the value of attribute localized_notifications.
-
#notification ⇒ Object
readonly
Returns the value of attribute notification.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(env, notification) ⇒ NotifierBase
constructor
A new instance of NotifierBase.
- #send_notification(device_token) ⇒ Object
Constructor Details
#initialize(env, notification) ⇒ NotifierBase
Returns a new instance of NotifierBase.
7 8 9 10 11 |
# File 'lib/notifiable/notifier_base.rb', line 7 def initialize(env, notification) @env, @notification = env, notification @localized_notifications = {} notification.localized_notifications.each{|l| @localized_notifications[l.locale] = l} end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
5 6 7 |
# File 'lib/notifiable/notifier_base.rb', line 5 def env @env end |
#localized_notifications ⇒ Object (readonly)
Returns the value of attribute localized_notifications.
5 6 7 |
# File 'lib/notifiable/notifier_base.rb', line 5 def localized_notifications @localized_notifications end |
#notification ⇒ Object (readonly)
Returns the value of attribute notification.
5 6 7 |
# File 'lib/notifiable/notifier_base.rb', line 5 def notification @notification end |
Instance Method Details
#close ⇒ Object
18 19 20 21 22 |
# File 'lib/notifiable/notifier_base.rb', line 18 def close flush save_receipts if Notifiable.save_receipts @notification.save end |
#send_notification(device_token) ⇒ Object
13 14 15 16 |
# File 'lib/notifiable/notifier_base.rb', line 13 def send_notification(device_token) localized_notification = self.localized_notification(device_token) enqueue(device_token, localized_notification) if localized_notification end |