class Moromi::Aws::Sns::Message::Apns
Attributes
alert[R]
badge[R]
category[R]
content_available[R]
custom_data[R]
mutable_content[R]
priority[R]
sound[R]
thread_id[R]
type[R]
Public Class Methods
new(alert:, badge:, sound: 'default', content_available: 1, mutable_content: 0, category: nil, thread_id: nil, priority: 10, type: nil, custom_data: {})
click to toggle source
# File lib/moromi/aws/sns/message/apns.rb, line 18 def initialize(alert:, badge:, sound: 'default', content_available: 1, mutable_content: 0, category: nil, thread_id: nil, priority: 10, type: nil, custom_data: {}) @alert = alert @badge = badge @sound = sound @content_available = content_available @mutable_content = mutable_content @category = category @thread_id = thread_id @priority = priority @type = type || self.class.name @custom_data = setup_initial_custom_data({type: @type}.merge(custom_data)) end
Private Class Methods
build_silent_push_message(priority: 10, custom_data: {})
click to toggle source
# File lib/moromi/aws/sns/message/apns.rb, line 63 def build_silent_push_message(priority: 10, custom_data: {}) new('', nil, sound: nil, content_available: 1, priority: priority, custom_data: custom_data) end
Public Instance Methods
to_hash()
click to toggle source
# File lib/moromi/aws/sns/message/apns.rb, line 32 def to_hash { alert: @alert, badge: @badge, sound: @sound, content_available: @content_available, mutable_content: @mutable_content, thread_id: @thread_id, category: @category, priority: @priority, type: @type, custom_data: @custom_data } end
to_message_json()
click to toggle source
# File lib/moromi/aws/sns/message/apns.rb, line 47 def to_message_json aps = to_hash %i[custom_data type content_available mutable_content].each { |k| aps.delete(k) } aps['content-available'] = @content_available aps['mutable-content'] = @mutable_content aps['thread-id'] = @thread_id @custom_data.merge({aps: aps}).to_json end
Private Instance Methods
setup_initial_custom_data(custom_data)
click to toggle source
# File lib/moromi/aws/sns/message/apns.rb, line 58 def setup_initial_custom_data(custom_data) custom_data end