Class: ADCK::Notification
- Inherits:
-
Object
- Object
- ADCK::Notification
- Extended by:
- Forwardable
- Defined in:
- lib/adck/notification.rb
Instance Attribute Summary collapse
-
#device_token ⇒ Object
Returns the value of attribute device_token.
-
#message ⇒ Object
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(device_token, message) ⇒ Notification
constructor
A new instance of Notification.
- #packaged_message ⇒ Object
- #packaged_notification ⇒ Object
- #packaged_token ⇒ Object
Constructor Details
#initialize(device_token, message) ⇒ Notification
7 8 9 10 |
# File 'lib/adck/notification.rb', line 7 def initialize(device_token, ) self.device_token = device_token self. = Message.build() end |
Instance Attribute Details
#device_token ⇒ Object
Returns the value of attribute device_token.
4 5 6 |
# File 'lib/adck/notification.rb', line 4 def device_token @device_token end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/adck/notification.rb', line 4 def end |
Instance Method Details
#packaged_message ⇒ Object
22 23 24 |
# File 'lib/adck/notification.rb', line 22 def .package end |
#packaged_notification ⇒ Object
12 13 14 15 16 |
# File 'lib/adck/notification.rb', line 12 def packaged_notification pt = packaged_token pm = .package [0, 0, 32, pt, 0, pm.bytesize, pm].pack("ccca*cca*") end |
#packaged_token ⇒ Object
18 19 20 |
# File 'lib/adck/notification.rb', line 18 def packaged_token [device_token.gsub(/[\s|<|>]/,'')].pack('H*') end |