Class: JPush::TagManager
- Inherits:
-
Object
- Object
- JPush::TagManager
- Defined in:
- lib/jpush/model/tag_manager.rb
Instance Attribute Summary collapse
-
#add ⇒ Object
Returns the value of attribute add.
-
#remove ⇒ Object
Returns the value of attribute remove.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ TagManager
constructor
A new instance of TagManager.
- #toJSON ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ TagManager
Returns a new instance of TagManager.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jpush/model/tag_manager.rb', line 5 def initialize(opts = {}) if opts[:add] != nil if opts[:add].class == Array && opts[:add].length <= 1000 @add = opts[:add] else raise ArgumentError.new('add should be array and size <= 1000.') end end if opts[:remove] != nil if opts[:remove].class == Array && opts[:remove].length <= 1000 @remove = opts[:remove] else raise ArgumentError.new('add should be array and size <= 1000.') end end end |
Instance Attribute Details
#add ⇒ Object
Returns the value of attribute add.
3 4 5 |
# File 'lib/jpush/model/tag_manager.rb', line 3 def add @add end |
#remove ⇒ Object
Returns the value of attribute remove.
3 4 5 |
# File 'lib/jpush/model/tag_manager.rb', line 3 def remove @remove end |
Class Method Details
.build(opts = {}) ⇒ Object
38 39 40 41 |
# File 'lib/jpush/model/tag_manager.rb', line 38 def self.build(opts = {}) tm = JPush::TagManager.new(opts) return tm end |
Instance Method Details
#toJSON ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/jpush/model/tag_manager.rb', line 24 def toJSON hash = {} registration_ids = {} if @add != nil registration_ids['add'] = @add end if @remove != nil registration_ids['remove'] = @remove end hash['registration_ids'] = registration_ids return hash end |