Class: Maia::FCM::Serializer
- Inherits:
-
Object
- Object
- Maia::FCM::Serializer
- Defined in:
- lib/maia/fcm/serializer.rb
Instance Method Summary collapse
-
#initialize(message, target) ⇒ Serializer
constructor
A new instance of Serializer.
- #to_h ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(message, target) ⇒ Serializer
Returns a new instance of Serializer.
4 5 6 7 |
# File 'lib/maia/fcm/serializer.rb', line 4 def initialize(, target) @message = @target = target end |
Instance Method Details
#to_h ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# 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 ⇒ Object
20 21 22 |
# File 'lib/maia/fcm/serializer.rb', line 20 def to_json to_h.to_json end |