Class: PushesUs::Notification
- Inherits:
-
Object
- Object
- PushesUs::Notification
- Defined in:
- lib/pushesus.rb
Instance Attribute Summary collapse
-
#alert ⇒ Object
Returns the value of attribute alert.
-
#device_identity ⇒ Object
Returns the value of attribute device_identity.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#network_key ⇒ Object
Returns the value of attribute network_key.
-
#sound ⇒ Object
Returns the value of attribute sound.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(network_key, device_identity, alert, sound = 'default') ⇒ Notification
constructor
A new instance of Notification.
- #send ⇒ Object
Constructor Details
#initialize(network_key, device_identity, alert, sound = 'default') ⇒ Notification
Returns a new instance of Notification.
25 26 27 |
# File 'lib/pushesus.rb', line 25 def initialize(network_key, device_identity, alert, sound='default') @network_key, @device_identity, @alert, @sound = network_key, device_identity, alert, sound end |
Instance Attribute Details
#alert ⇒ Object
Returns the value of attribute alert.
14 15 16 |
# File 'lib/pushesus.rb', line 14 def alert @alert end |
#device_identity ⇒ Object
Returns the value of attribute device_identity.
14 15 16 |
# File 'lib/pushesus.rb', line 14 def device_identity @device_identity end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
15 16 17 |
# File 'lib/pushesus.rb', line 15 def errors @errors end |
#network_key ⇒ Object
Returns the value of attribute network_key.
14 15 16 |
# File 'lib/pushesus.rb', line 14 def network_key @network_key end |
#sound ⇒ Object
Returns the value of attribute sound.
14 15 16 |
# File 'lib/pushesus.rb', line 14 def sound @sound end |
Class Method Details
.send(network_key, device_identity, alert, sound = 'default') ⇒ Object
18 19 20 21 22 |
# File 'lib/pushesus.rb', line 18 def send(network_key, device_identity, alert, sound='default') p = self.new(network_key, device_identity, alert, sound) p.send return p end |
Instance Method Details
#send ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pushesus.rb', line 29 def send result = PushesUs.post('/notifications.json', :query => { :notification => { :device_identity => device_identity, :network_key => network_key, :alert => alert, :sound => sound }}) if result['success'] return true else @errors = result['errors'] return false end end |