Class: Rpush::Client::ActiveRecord::Notification
Instance Method Summary
collapse
included, #payload, #payload_data_size
#multi_json_dump, #multi_json_load
Instance Method Details
#data ⇒ Object
34
35
36
|
# File 'lib/rpush/client/active_record/notification.rb', line 34
def data
multi_json_load(read_attribute(:data)) if read_attribute(:data)
end
|
#data=(attrs) ⇒ Object
17
18
19
20
21
|
# File 'lib/rpush/client/active_record/notification.rb', line 17
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
|
#notification ⇒ Object
38
39
40
|
# File 'lib/rpush/client/active_record/notification.rb', line 38
def notification
multi_json_load(read_attribute(:notification)) if read_attribute(:notification)
end
|
#notification=(attrs) ⇒ Object
23
24
25
26
27
|
# File 'lib/rpush/client/active_record/notification.rb', line 23
def notification=(attrs)
return unless attrs
fail ArgumentError, 'must be a Hash' unless attrs.is_a?(Hash)
write_attribute(:notification, multi_json_dump(attrs.merge(notification || {})))
end
|
#registration_ids=(ids) ⇒ Object
29
30
31
32
|
# File 'lib/rpush/client/active_record/notification.rb', line 29
def registration_ids=(ids)
ids = [ids] if ids && !ids.is_a?(Array)
super
end
|