Class: JPush::Notification
- Inherits:
-
Object
- Object
- JPush::Notification
- Defined in:
- lib/jpush/model/notification/notification.rb
Instance Attribute Summary collapse
-
#alert ⇒ Object
Returns the value of attribute alert.
-
#android ⇒ Object
Returns the value of attribute android.
-
#ios ⇒ Object
Returns the value of attribute ios.
-
#winphone ⇒ Object
Returns the value of attribute winphone.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Notification
constructor
A new instance of Notification.
- #toJSON ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Notification
Returns a new instance of Notification.
4 5 6 7 8 9 |
# File 'lib/jpush/model/notification/notification.rb', line 4 def initialize(opts = {}) @alert = opts[:alert] @android = opts[:android] @ios = opts[:ios] @winphone = opts[:winphone] end |
Instance Attribute Details
#alert ⇒ Object
Returns the value of attribute alert.
3 4 5 |
# File 'lib/jpush/model/notification/notification.rb', line 3 def alert @alert end |
#android ⇒ Object
Returns the value of attribute android.
3 4 5 |
# File 'lib/jpush/model/notification/notification.rb', line 3 def android @android end |
#ios ⇒ Object
Returns the value of attribute ios.
3 4 5 |
# File 'lib/jpush/model/notification/notification.rb', line 3 def ios @ios end |
#winphone ⇒ Object
Returns the value of attribute winphone.
3 4 5 |
# File 'lib/jpush/model/notification/notification.rb', line 3 def winphone @winphone end |
Class Method Details
.build(opts = {}) ⇒ Object
29 30 31 32 |
# File 'lib/jpush/model/notification/notification.rb', line 29 def self.build(opts = {}) notification=JPush::Notification.new(opts) return notification end |
Instance Method Details
#toJSON ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jpush/model/notification/notification.rb', line 11 def toJSON array = {} if @alert != nil && alert.lstrip.length > 0 array['alert'] = @alert end if @android != nil array['android'] = @android.toJSON end if @ios != nil array['ios'] = @ios.toJSON end if @winphone != nil array['winphone'] = @winphone.toJSON end return array end |