Module: Rpush::Client::ActiveModel::Webpush::Notification
Defined Under Namespace
Classes: RegistrationValidator
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Method Details
#as_json(_options = nil) ⇒ Object
54
55
56
57
58
59
60
|
# File 'lib/rpush/client/active_model/webpush/notification.rb', line 54
def as_json(_options = nil)
{
'data' => data,
'time_to_live' => time_to_live,
'registration_ids' => registration_ids
}
end
|
#data=(value) ⇒ Object
36
37
38
39
|
# File 'lib/rpush/client/active_model/webpush/notification.rb', line 36
def data=(value)
value = value.stringify_keys if value.respond_to?(:stringify_keys)
super value
end
|
#message ⇒ Object
45
46
47
|
# File 'lib/rpush/client/active_model/webpush/notification.rb', line 45
def message
data['message'].presence if data
end
|
#subscription ⇒ Object
41
42
43
|
# File 'lib/rpush/client/active_model/webpush/notification.rb', line 41
def subscription
@subscription ||= registration_ids.first.deep_symbolize_keys
end
|
#urgency ⇒ Object
50
51
52
|
# File 'lib/rpush/client/active_model/webpush/notification.rb', line 50
def urgency
data['urgency'].presence if data
end
|