Module: Rpush::Client::ActiveModel::Notification

Included in:
Rpush::Client::ActiveRecord::Notification, Redis::Notification
Defined in:
lib/rpush/client/active_model/notification.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
# File 'lib/rpush/client/active_model/notification.rb', line 5

def self.included(base)
  base.instance_eval do
    validates :expiry, numericality: true, allow_nil: true
    validates :app, presence: true
  end
end

Instance Method Details

#payloadObject



12
13
14
# File 'lib/rpush/client/active_model/notification.rb', line 12

def payload
  multi_json_dump(as_json)
end

#payload_data_sizeObject



16
17
18
# File 'lib/rpush/client/active_model/notification.rb', line 16

def payload_data_size
  multi_json_dump(as_json['data']).bytesize
end