Class: JPush::AndroidNotification
- Inherits:
-
Object
- Object
- JPush::AndroidNotification
- Defined in:
- lib/jpush/model/notification/android_notification.rb
Instance Attribute Summary collapse
-
#alert ⇒ Object
Returns the value of attribute alert.
-
#builder_id ⇒ Object
Returns the value of attribute builder_id.
-
#extras ⇒ Object
Returns the value of attribute extras.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ AndroidNotification
constructor
A new instance of AndroidNotification.
- #toJSON ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ AndroidNotification
Returns a new instance of AndroidNotification.
4 5 6 7 8 9 |
# File 'lib/jpush/model/notification/android_notification.rb', line 4 def initialize(opts = {}) @alert = opts[:alert] @title = opts[:title] @builder_id = opts[:builder_id] @extras = opts[:extras] end |
Instance Attribute Details
#alert ⇒ Object
Returns the value of attribute alert.
3 4 5 |
# File 'lib/jpush/model/notification/android_notification.rb', line 3 def alert @alert end |
#builder_id ⇒ Object
Returns the value of attribute builder_id.
3 4 5 |
# File 'lib/jpush/model/notification/android_notification.rb', line 3 def builder_id @builder_id end |
#extras ⇒ Object
Returns the value of attribute extras.
3 4 5 |
# File 'lib/jpush/model/notification/android_notification.rb', line 3 def extras @extras end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/jpush/model/notification/android_notification.rb', line 3 def title @title end |
Class Method Details
.build(opts = {}) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/jpush/model/notification/android_notification.rb', line 29 def self.build(opts = {}) android = JPush::AndroidNotification.new(opts) if android.alert == nil raise ArgumentError.new('android the alert should be setted') end return android 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/android_notification.rb', line 11 def toJSON array = {} if @alert != nil then array['alert'] = @alert end if @title != nil then array['title'] = @title end if @builder_id != nil then array['builder_id'] = @builder_id end if @extras != nil then array['extras'] = @extras end return array end |