Class: IonicNotification::Notification
- Inherits:
-
Object
- Object
- IonicNotification::Notification
- Defined in:
- lib/ionic_notification/notification.rb
Instance Attribute Summary collapse
-
#android_payload ⇒ Object
Returns the value of attribute android_payload.
-
#ios_payload ⇒ Object
Returns the value of attribute ios_payload.
-
#message ⇒ Object
Returns the value of attribute message.
-
#production ⇒ Object
Returns the value of attribute production.
-
#scheduled ⇒ Object
Returns the value of attribute scheduled.
-
#title ⇒ Object
Returns the value of attribute title.
-
#tokens ⇒ Object
Returns the value of attribute tokens.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Notification
constructor
A new instance of Notification.
- #send ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Notification
Returns a new instance of Notification.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ionic_notification/notification.rb', line 6 def initialize( = {}) = [:message] @tokens = init_tokens([:tokens]) @title ||= [:title] || default_title ||= [:message] || if [:android_payload] @android_payload ||= assign_payload([:android_payload]) end if [:ios_payload] @ios_payload ||= assign_payload([:ios_payload]) end if [:payload] @android_payload ||= assign_payload([:payload]) @ios_payload ||= assign_payload([:payload]) end @android_payload ||= default_payload @ios_payload ||= default_payload @scheduled = [:scheduled] @production = [:production] || init_production end |
Instance Attribute Details
#android_payload ⇒ Object
Returns the value of attribute android_payload.
3 4 5 |
# File 'lib/ionic_notification/notification.rb', line 3 def android_payload @android_payload end |
#ios_payload ⇒ Object
Returns the value of attribute ios_payload.
3 4 5 |
# File 'lib/ionic_notification/notification.rb', line 3 def ios_payload @ios_payload end |
#message ⇒ Object
Returns the value of attribute message.
3 4 5 |
# File 'lib/ionic_notification/notification.rb', line 3 def end |
#production ⇒ Object
Returns the value of attribute production.
3 4 5 |
# File 'lib/ionic_notification/notification.rb', line 3 def production @production end |
#scheduled ⇒ Object
Returns the value of attribute scheduled.
3 4 5 |
# File 'lib/ionic_notification/notification.rb', line 3 def scheduled @scheduled end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/ionic_notification/notification.rb', line 3 def title @title end |
#tokens ⇒ Object
Returns the value of attribute tokens.
3 4 5 |
# File 'lib/ionic_notification/notification.rb', line 3 def tokens @tokens end |
Instance Method Details
#send ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/ionic_notification/notification.rb', line 34 def send if || IonicNotification. service = PushService.new self service.notify! else self.class.new_logger. end end |