Class: APNS::Packager
- Inherits:
-
Object
- Object
- APNS::Packager
- Defined in:
- lib/apns/packager.rb
Instance Attribute Summary collapse
-
#notification ⇒ Object
readonly
Returns the value of attribute notification.
Instance Method Summary collapse
-
#initialize(notification) ⇒ Packager
constructor
A new instance of Packager.
- #method_missing(meth, *args, &block) ⇒ Object
- #package ⇒ Object
Constructor Details
#initialize(notification) ⇒ Packager
Returns a new instance of Packager.
6 7 8 |
# File 'lib/apns/packager.rb', line 6 def initialize(notification) @notification = notification end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/apns/packager.rb', line 10 def method_missing(meth, *args, &block) if %w[device_token alert badge sound other].include?(meth.to_s) notification.send(meth, *args, &block) else super end end |
Instance Attribute Details
#notification ⇒ Object (readonly)
Returns the value of attribute notification.
4 5 6 |
# File 'lib/apns/packager.rb', line 4 def notification @notification end |
Instance Method Details
#package ⇒ Object
18 19 20 |
# File 'lib/apns/packager.rb', line 18 def package [0, 0, 32, token, 0, .bytesize, ].pack('ccca*cca*') end |