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 ⇒ PushBot::Response
Retrieve information about the device with this token.
-
#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 21 22 |
# 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? && !(Array === token) type = nil [:token] = token else [:tokens] = token end Request.new(:deviceToken).put(type, ) end |
#info ⇒ PushBot::Response
Retrieve information about the device with this token
27 28 29 |
# File 'lib/push_bot/device.rb', line 27 def info Request.new(:deviceToken).get(:one, :token => token) end |
#remove ⇒ PushBot::Response
Remove a specific user from PushBots
34 35 36 37 38 |
# File 'lib/push_bot/device.rb', line 34 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 |