Module: GCM

Includes:
HTTParty
Defined in:
lib/pushmeup/gcm/core.rb,
lib/pushmeup/gcm/notification.rb

Defined Under Namespace

Classes: Notification

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.formatObject

Returns the value of attribute format.



13
14
15
# File 'lib/pushmeup/gcm/core.rb', line 13

def format
  @format
end

.hostObject

Returns the value of attribute host.



13
14
15
# File 'lib/pushmeup/gcm/core.rb', line 13

def host
  @host
end

.key(identity = nil) ⇒ Object

Returns the value of attribute key.



13
14
15
# File 'lib/pushmeup/gcm/core.rb', line 13

def key
  @key
end

Class Method Details

.key_identitiesObject



24
25
26
27
28
29
30
# File 'lib/pushmeup/gcm/core.rb', line 24

def key_identities
  if @key.is_a?(Hash)
    return @key.keys
  else
    return nil
  end
end

.send_notification(device_tokens, data = {}, options = {}) ⇒ Object



33
34
35
36
# File 'lib/pushmeup/gcm/core.rb', line 33

def self.send_notification(device_tokens, data = {}, options = {})
  n = GCM::Notification.new(device_tokens, data, options)
  self.send_notifications([n])
end

.send_notifications(notifications) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/pushmeup/gcm/core.rb', line 38

def self.send_notifications(notifications)
  responses = []
  notifications.each do |n|
    responses << self.prepare_and_send(n)
  end
  responses
end