Class: PushBot::Device
Instance Attribute Summary
Attributes inherited from Api
Instance Method Summary collapse
-
#add(registration_options = {}) ⇒ PushBot::Response
Add a specific user or batch of users to PushBots.
- #info ⇒ Object
-
#remove ⇒ PushBot::Response
Remove a specific user from PushBots.
Methods inherited from Api
#batch?, #initialize, #token?, #user?
Constructor Details
This class inherits a constructor from PushBot::Api
Instance Method Details
#add(registration_options = {}) ⇒ PushBot::Response
Add a specific user or batch of users to PushBots
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/push_bot/device.rb', line 7 def add(={}) raise(ArgumentError, 'Batch device add should only be to a single platform') if Array === token && platforms.size != 1 , type = .merge( :platform => platform ), :batch if user? type = nil [:token] = token end Request.new(:deviceToken).put(type, ) end |
#info ⇒ Object
22 23 24 |
# File 'lib/push_bot/device.rb', line 22 def info Request.new(:deviceToken).get(:one, :token => token) end |
#remove ⇒ PushBot::Response
Remove a specific user from PushBots
29 30 31 32 33 |
# File 'lib/push_bot/device.rb', line 29 def remove raise(ArgumentError, 'A token and platform is required for removal') unless token && token Request.new(:deviceToken).put(:del, :token => token, :platform => platform) end |