Class: RubyPushNotifications::GCM::GCMNotification

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-push-notifications/gcm/gcm_notification.rb

Overview

Encapsulates a GCM Notification. By default only Required fields are set. (developer.android.com/google/gcm/server-ref.html#send-downstream)

Author:

  • Carlos Alonso

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(registration_ids, data) ⇒ GCMNotification

Initializes the notification


18
19
20
21
# File 'lib/ruby-push-notifications/gcm/gcm_notification.rb', line 18

def initialize(registration_ids, data)
  @registration_ids = registration_ids
  @data = data
end

Instance Attribute Details

#resultsArray


12
13
14
# File 'lib/ruby-push-notifications/gcm/gcm_notification.rb', line 12

def results
  @results
end

Instance Method Details

#as_gcm_jsonString


25
26
27
28
29
30
# File 'lib/ruby-push-notifications/gcm/gcm_notification.rb', line 25

def as_gcm_json
  JSON.dump(
    registration_ids: @registration_ids,
    data: @data
  )
end