Class: Rpush::Client::ActiveRecord::Apns::Notification
- Inherits:
-
Notification
- Object
- ActiveRecord::Base
- Notification
- Rpush::Client::ActiveRecord::Apns::Notification
- Defined in:
- lib/rpush/client/active_record/apns/notification.rb
Constant Summary
Constants included from Rpush::Client::ActiveModel::Apns::Notification
Rpush::Client::ActiveModel::Apns::Notification::APNS_DEFAULT_EXPIRY, Rpush::Client::ActiveModel::Apns::Notification::APNS_PRIORITIES, Rpush::Client::ActiveModel::Apns::Notification::APNS_PRIORITY_CONSERVE_POWER, Rpush::Client::ActiveModel::Apns::Notification::APNS_PRIORITY_IMMEDIATE, Rpush::Client::ActiveModel::Apns::Notification::CONTENT_AVAILABLE_KEY, Rpush::Client::ActiveModel::Apns::Notification::MDM_KEY
Instance Method Summary collapse
Methods included from Rpush::Client::ActiveModel::Apns::Notification
#as_json, #content_available=, #device_token=, included, #mdm=, #to_binary
Methods included from Deprecatable
Methods inherited from Notification
#data, #data=, #registration_ids=
Methods included from Rpush::Client::ActiveModel::Notification
included, #payload, #payload_data_size
Methods included from MultiJsonHelper
#multi_json_dump, #multi_json_load
Instance Method Details
#alert ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rpush/client/active_record/apns/notification.rb', line 19 def alert string_or_json = read_attribute(:alert) if has_attribute?(:alert_is_json) if alert_is_json? multi_json_load(string_or_json) else string_or_json end else begin multi_json_load(string_or_json) rescue StandardError string_or_json end end end |
#alert=(alert) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/rpush/client/active_record/apns/notification.rb', line 9 def alert=(alert) if alert.is_a?(Hash) write_attribute(:alert, multi_json_dump(alert)) self.alert_is_json = true if has_attribute?(:alert_is_json) else write_attribute(:alert, alert) self.alert_is_json = false if has_attribute?(:alert_is_json) end end |