Class: Zumobi::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/zumobi/notifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNotifier

Returns a new instance of Notifier.



9
10
11
# File 'lib/zumobi/notifier.rb', line 9

def initialize
    @logger = Zumobi::NotificationsLogger.new
end

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



7
8
9
# File 'lib/zumobi/notifier.rb', line 7

def logger
  @logger
end

Instance Method Details

#push(notification) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/zumobi/notifier.rb', line 13

def push(notification)
    config = SimpleConfig.for(:ua)
    if (config.application_key.blank? || config.application_secret.blank? || config.master_secret.blank?)
        raise "You must include a simple config :ua config with :application_key, :application_secret and :master_secret for this application."
    end
    Urbanairship.application_key = config.application_key
    Urbanairship.application_secret = config.application_secret
    Urbanairship.master_secret = config.master_secret
    Urbanairship.logger = @logger
    Urbanairship.request_timeout = 15
    response = Urbanairship.push(notification)
rescue Exception => e
    ExceptionHandler.error e
end