Sha256: ffcee0e8b9f1ce26c6b2f08966454c96938a29da223eedd3f7c29194e9261e40
Contents?: true
Size: 1.87 KB
Versions: 2
Compression:
Stored size: 1.87 KB
Contents
module Rpush module Client module Redis class Notification include Rpush::MultiJsonHelper include Modis::Model include Rpush::Client::ActiveModel::Notification after_create :register_notification self.namespace = 'notifications' def self.absolute_pending_namespace "#{absolute_namespace}:pending" end def self.absolute_retryable_namespace "#{absolute_namespace}:retryable" end attribute :badge, :integer attribute :device_token, :string attribute :sound, :string, default: 'default' attribute :alert, :hash, strict: false attribute :data, :hash attribute :expiry, :integer, default: 1.day.to_i attribute :delivered, :boolean attribute :delivered_at, :timestamp attribute :failed, :boolean attribute :failed_at, :timestamp attribute :fail_after, :timestamp attribute :retries, :integer, default: 0 attribute :error_code, :integer attribute :error_description, :string attribute :deliver_after, :timestamp attribute :alert_is_json, :boolean attribute :app_id, :integer attribute :collapse_key, :string attribute :delay_while_idle, :boolean attribute :registration_ids, :array attribute :uri, :string attribute :priority, :integer def app return nil unless app_id @app ||= Rpush::Client::Redis::App.find(app_id) end def app=(app) @app = app if app self.app_id = app.id else self.app_id = nil end end private def register_notification Modis.with_connection do |redis| redis.zadd(self.class.absolute_pending_namespace, id, id) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rpush-2.0.0.beta2 | lib/rpush/client/redis/notification.rb |
rpush-2.0.0.beta1 | lib/rpush/client/redis/notification.rb |