Class: Pushbots::Devices
- Inherits:
-
Object
- Object
- Pushbots::Devices
- Defined in:
- lib/pushbots/devices.rb
Overview
Devices class
Constant Summary collapse
- PLATFORM_TYPE =
{ ios: 0, android: 1 }.freeze
Instance Attribute Summary collapse
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#tokens ⇒ Object
Returns the value of attribute tokens.
Instance Method Summary collapse
-
#initialize(tokens, platform, tags = nil) ⇒ Devices
constructor
A new instance of Devices.
- #register ⇒ Object
Constructor Details
#initialize(tokens, platform, tags = nil) ⇒ Devices
Returns a new instance of Devices.
7 8 9 10 11 |
# File 'lib/pushbots/devices.rb', line 7 def initialize(tokens, platform, = nil) self.tokens = tokens self.platform = platform self. = if end |
Instance Attribute Details
#platform ⇒ Object
Returns the value of attribute platform.
4 5 6 |
# File 'lib/pushbots/devices.rb', line 4 def platform @platform end |
#tags ⇒ Object
Returns the value of attribute tags.
4 5 6 |
# File 'lib/pushbots/devices.rb', line 4 def end |
#tokens ⇒ Object
Returns the value of attribute tokens.
4 5 6 |
# File 'lib/pushbots/devices.rb', line 4 def tokens @tokens end |
Instance Method Details
#register ⇒ Object
13 14 15 16 17 18 |
# File 'lib/pushbots/devices.rb', line 13 def register body = { tokens: tokens, platform: PLATFORM_TYPE[platform] } body[:tags] = if response = Request.register_batch(body) response.code == 201 end |