module MultitenantPush::APNS

Public Class Methods

feedback() click to toggle source
# File lib/multitenant_push/apns.rb, line 18
def self.feedback
  self.load_credentials()
  APNS2.feedback
end
load_credentials() click to toggle source
# 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) click to toggle source
# File lib/multitenant_push/apns.rb, line 27
def self.method_missing(method, *args, &block)
  APNS2.send method, *args
end
methods() click to toggle source
# File lib/multitenant_push/apns.rb, line 23
def self.methods
  APNS2.methods
end
send_notification(device_token, message) click to toggle source
# 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) click to toggle source
# File lib/multitenant_push/apns.rb, line 13
def self.send_notifications(notifications)
  self.load_credentials()
  APNS2.send_notifications(notifications)
end