Module: MultitenantPush::GCM

Includes:
GCM.clone
Defined in:
lib/multitenant_push/gcm.rb

Class Method Summary collapse

Class Method Details

.load_credentialsObject

Raises:



22
23
24
25
26
27
28
29
30
# File 'lib/multitenant_push/gcm.rb', line 22

def self.load_credentials
  raise NoTenant if Tenant.current_tenant.nil?
  credentials = Credential.first
  raise NoTenantCredentials if credentials.nil? || credentials.gcm_host.blank? || credentials.gcm_key.blank?

  GCM.host = credentials.gcm_host
  GCM.key = credentials.gcm_key

end

.method_missing(method, *args, &block) ⇒ Object



17
18
19
# File 'lib/multitenant_push/gcm.rb', line 17

def self.method_missing(method, *args, &block)
  GCM2.send method, *args
end

.methodsObject



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

def self.methods
  GCM2.methods
end

.send_notification(device_tokens, data) ⇒ Object



8
9
10
11
# File 'lib/multitenant_push/gcm.rb', line 8

def self.send_notification( device_tokens, data)
  self.load_credentials()
  GCM2.send_notification( device_tokens, data)
end