Class: Zumobi::Notifier
- Inherits:
-
Object
- Object
- Zumobi::Notifier
- Defined in:
- lib/zumobi/notifier.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize ⇒ Notifier
constructor
A new instance of Notifier.
- #push(notification) ⇒ Object
Constructor Details
#initialize ⇒ Notifier
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
#logger ⇒ Object
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 |