Sha256: c1774177d3ca7a3b9c479122c56d48070c94c3ce735d1c99eaaf3da28df1d723

Contents?: true

Size: 1.24 KB

Versions: 14

Compression:

Stored size: 1.24 KB

Contents

module Rpush
  module Client
    module ActiveRecord
      class Notification < ::ActiveRecord::Base
        include Rpush::MultiJsonHelper
        include Rpush::Client::ActiveModel::Notification

        self.table_name = 'rpush_notifications'

        serialize :registration_ids
        serialize :url_args

        belongs_to :app, class_name: 'Rpush::Client::ActiveRecord::App'

        if Rpush.attr_accessible_available?
          attr_accessible :badge, :device_token, :sound, :alert, :data, :expiry, :delivered,
                          :delivered_at, :failed, :failed_at, :error_code, :error_description, :deliver_after,
                          :alert_is_json, :app, :app_id, :collapse_key, :delay_while_idle, :registration_ids,
                          :uri, :url_args, :category
        end

        def data=(attrs)
          return unless attrs
          fail ArgumentError, "must be a Hash" unless attrs.is_a?(Hash)
          write_attribute(:data, multi_json_dump(attrs.merge(data || {})))
        end

        def registration_ids=(ids)
          ids = [ids] if ids && !ids.is_a?(Array)
          super
        end

        def data
          multi_json_load(read_attribute(:data)) if read_attribute(:data)
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rpush-2.5.0 lib/rpush/client/active_record/notification.rb
rpush-2.4.0-java lib/rpush/client/active_record/notification.rb
rpush-2.4.0 lib/rpush/client/active_record/notification.rb
rpush-2.3.2-java lib/rpush/client/active_record/notification.rb
rpush-2.3.2 lib/rpush/client/active_record/notification.rb
rpush-2.3.1-java lib/rpush/client/active_record/notification.rb
rpush-2.3.1 lib/rpush/client/active_record/notification.rb
rpush-2.3.0-java lib/rpush/client/active_record/notification.rb
rpush-2.3.0 lib/rpush/client/active_record/notification.rb
rpush-2.3.0.rc1 lib/rpush/client/active_record/notification.rb
rpush-2.2.0-java lib/rpush/client/active_record/notification.rb
rpush-2.2.0 lib/rpush/client/active_record/notification.rb
rpush-2.1.0-java lib/rpush/client/active_record/notification.rb
rpush-2.1.0 lib/rpush/client/active_record/notification.rb