class Firebase::Messaging::Request::Body

Attributes

data[RW]
notification[R]

Public Class Methods

new() click to toggle source
# File lib/firebase/messaging/request/body.rb, line 8
def initialize
  @notification = Notification.new # NOTE: title, body, badge, icon
  @data = {} # NOTE: custom data for app
end

Public Instance Methods

notification=(title: nil, body: nil, badge: nil, icon: nil) click to toggle source
# File lib/firebase/messaging/request/body.rb, line 13
def notification=(title: nil, body: nil, badge: nil, icon: nil)
  @notification.title = title unless title.nil?
  @notification.body = body unless body.nil?
  @notification.badge = badge unless badge.nil?
  @notification.icon = icon unless icon.nil?
end
payload() click to toggle source
# File lib/firebase/messaging/request/body.rb, line 20
def payload
  message_payload = {}
  message_payload[:notification] = @notification.payload unless @notification.payload.empty?
  message_payload[:data] = @data unless @data.empty?
  message_payload
end