Module: MultitenantPush::APNS

Defined in:
lib/multitenant_push/apns.rb

Class Method Summary collapse

Class Method Details

.feedbackObject



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

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

.load_credentialsObject



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

def self.load_credentials
  raise NoTenantCredentials if Tenant.current_tenant.nil?
  credentials = Credential.first
  raise NoTenant 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



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

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

.methodsObject



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

def self.methods
  APNS2.methods
end

.send_notification(device_token, message) ⇒ Object



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

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

.send_notifications(notifications) ⇒ Object



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

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