Module: MultitenantPush::APNS

Includes:
APNS.clone
Defined in:
lib/multitenant_push/apns.rb

Class Method Summary collapse

Class Method Details

.feedbackObject



18
19
20
21
# File 'lib/multitenant_push/apns.rb', line 18

def self.feedback
  self.load_credentials()
  APNS2.feedback
end

.load_credentialsObject

Raises:



32
33
34
35
36
37
38
39
40
41
# File 'lib/multitenant_push/apns.rb', line 32

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

  APNS.host = credentials.apns_host
  APNS.pass = credentials.apns_pass
  APNS.pem = "lib/#{Tenant.current_tenant.name}.pem"

end

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



27
28
29
# File 'lib/multitenant_push/apns.rb', line 27

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

.methodsObject



23
24
25
# File 'lib/multitenant_push/apns.rb', line 23

def self.methods
  APNS2.methods
end

.send_notification(device_token, message) ⇒ Object



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

def self.send_notification(device_token, message)
  self.load_credentials()
  APNS2.send_notification(device_token, message)
end

.send_notifications(notifications) ⇒ Object



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

def self.send_notifications(notifications)
  self.load_credentials()
  APNS2.send_notifications(notifications)
end