Sha256: a7a3543fd4939881037d900308ce0bb38eaa2e8ca5dc4e1e1cb8b4b87fcaeeec
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
module Notifiable class NotifierBase attr_reader :env, :notification def initialize(env, notification) @env, @notification = env, notification end def send_notification(device_token) localized_notification = self.localized_notification(device_token) enqueue(device_token, localized_notification) if localized_notification end def close flush save_receipts end protected def flush end def localized_notification(device_token) self.notification.localized_notification(device_token.locale) end def processed(device_token, status) receipts << {localized_notification_id: self.localized_notification(device_token).id, device_token_id: device_token.id, status: status, created_at: DateTime.now} save_receipts if receipts.count >= Notifiable.notification_status_batch_size end def test_env? self.env == "test" end private def receipts @receipts ||= [] end def save_receipts Notifiable::NotificationStatus.bulk_insert! receipts @receipts = [] @notification.summarise end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
notifiable-rails-0.21.3 | lib/notifiable/notifier_base.rb |
notifiable-rails-0.21.2 | lib/notifiable/notifier_base.rb |