class Pushbots::Device
Device
class
Constants
- PLATFORM_TYPE
- PLATFORM_TYPE_R
Attributes
platform[RW]
token[RW]
Public Class Methods
new(token, platform = nil)
click to toggle source
# File lib/pushbots/device.rb, line 8 def initialize(token, platform = nil) self.token = token self.platform = platform if platform end
Public Instance Methods
delete()
click to toggle source
# File lib/pushbots/device.rb, line 28 def delete body = { token: token, platform: PLATFORM_TYPE[platform] } response = Request.delete(body) response.code == 200 end
info()
click to toggle source
# File lib/pushbots/device.rb, line 13 def info response = Request.info(token) if response.code == 200 http_response = JSON.parse(response) self.platform = PLATFORM_TYPE_R[http_response['platform']] self.tags = http_response['tags'] end end
register()
click to toggle source
# File lib/pushbots/device.rb, line 22 def register body = { token: token, platform: PLATFORM_TYPE[platform] } response = Request.register(body) response.code == 201 end