class RubyPushNotifications::GCM::GCMNotification
Encapsulates a GCM
Notification. By default only Required fields are set. (developer.android.com/google/gcm/server-ref.html#send-downstream)
@author Carlos Alonso
Public Class Methods
new(registration_ids, data)
click to toggle source
Initializes the notification
@param [Array]. Array with the receiver's GCM
registration ids. @param [Hash]. Payload to send.
# File lib/ruby-push-notifications/gcm/gcm_notification.rb, line 16 def initialize(registration_ids, data) @registration_ids = registration_ids @data = data end
Public Instance Methods
as_gcm_json()
click to toggle source
@return [String]. The GCM's JSON format for the payload to send.
(https://developer.android.com/google/gcm/server-ref.html#send-downstream)
# File lib/ruby-push-notifications/gcm/gcm_notification.rb, line 23 def as_gcm_json JSON.dump( registration_ids: @registration_ids, data: @data ) end