Class: Nuge::Clients::Urbanairship
- Inherits:
-
Object
- Object
- Nuge::Clients::Urbanairship
- Defined in:
- lib/nuge/clients/urbanairship.rb
Instance Attribute Summary collapse
-
#expander ⇒ Object
writeonly
Sets the attribute expander.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Urbanairship
constructor
A new instance of Urbanairship.
- #push(ids, message) ⇒ Object
- #pusher ⇒ Object
- #register(id, options = {}) ⇒ Object
- #unregister(id, options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Urbanairship
Returns a new instance of Urbanairship.
9 10 11 12 |
# File 'lib/nuge/clients/urbanairship.rb', line 9 def initialize( = {}) @expander = [:expander] @options = end |
Instance Attribute Details
#expander=(value) ⇒ Object (writeonly)
Sets the attribute expander
7 8 9 |
# File 'lib/nuge/clients/urbanairship.rb', line 7 def (value) @expander = value end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/nuge/clients/urbanairship.rb', line 6 def @options end |
Instance Method Details
#push(ids, message) ⇒ Object
30 31 32 33 34 |
# File 'lib/nuge/clients/urbanairship.rb', line 30 def push(ids, ) formatter = .delete(:formatter) || Nuge::Formatters::Aps pusher.push(formatter.call(ids, )) end |
#pusher ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/nuge/clients/urbanairship.rb', line 14 def pusher @pusher ||= ::Urbanairship.tap do |serv| serv.application_key = [:application_key] serv.application_secret = [:application_secret] serv.master_secret = [:master_secret] end end |
#register(id, options = {}) ⇒ Object
22 23 24 |
# File 'lib/nuge/clients/urbanairship.rb', line 22 def register(id, = {}) pusher.register_device(id, ) end |
#unregister(id, options = {}) ⇒ Object
26 27 28 |
# File 'lib/nuge/clients/urbanairship.rb', line 26 def unregister(id, = {}) pusher.unregister_device(id, ) end |