class Maia::FCM::Serializer

Public Class Methods

new(message, target) click to toggle source
# File lib/maia/fcm/serializer.rb, line 4
def initialize(message, target)
  @message = message
  @target  = target
end

Public Instance Methods

to_h() click to toggle source
# File lib/maia/fcm/serializer.rb, line 9
def to_h
  {
    message: {
      data: @message.data.to_h,
      notification: notification.to_h,
      android: android.to_h,
      apns: apns.to_h
    }.merge(@target.to_h)
  }
end
to_json() click to toggle source
# File lib/maia/fcm/serializer.rb, line 20
def to_json
  to_h.to_json
end

Private Instance Methods

android() click to toggle source
# File lib/maia/fcm/serializer.rb, line 29
def android
  Maia::FCM::Platform::Android.new @message
end
apns() click to toggle source
# File lib/maia/fcm/serializer.rb, line 33
def apns
  Maia::FCM::Platform::APNS.new @message
end
notification() click to toggle source
# File lib/maia/fcm/serializer.rb, line 25
def notification
  Maia::FCM::Notification.new @message
end