Class: RubyPushNotifications::GCM::GCMPusher
- Inherits:
-
Object
- Object
- RubyPushNotifications::GCM::GCMPusher
- Defined in:
- lib/ruby-push-notifications/gcm/gcm_pusher.rb
Overview
This class is responsible for sending notifications to the GCM service.
Instance Method Summary collapse
-
#initialize(key, options = {}) ⇒ GCMPusher
constructor
Initializes the GCMPusher.
-
#push(notifications) ⇒ Object
Actually pushes the given notifications.
Constructor Details
#initialize(key, options = {}) ⇒ GCMPusher
Initializes the GCMPusher
18 19 20 21 |
# File 'lib/ruby-push-notifications/gcm/gcm_pusher.rb', line 18 def initialize(key, = {}) @key = key @options = end |
Instance Method Details
#push(notifications) ⇒ Object
Actually pushes the given notifications. Assigns every notification an array with the result of each individual notification.
28 29 30 31 32 |
# File 'lib/ruby-push-notifications/gcm/gcm_pusher.rb', line 28 def push(notifications) notifications.each do |notif| notif.results = GCMConnection.post notif.as_gcm_json, @key, @options end end |