Sha256: fecb81c1d831b00fc5fe9393824525f15586a271defa1d52151bb37c07bdb214
Contents?: true
Size: 1.88 KB
Versions: 6
Compression:
Stored size: 1.88 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, [:string, :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
6 entries across 6 versions & 1 rubygems