class BMO::APNS::Notification::DeviceToken

The DeviceToken is the id of a Device for an App

Attributes

token[R]

Public Class Methods

new(token) click to toggle source
# File lib/bmo/apns/notification.rb, line 89
def initialize(token)
  @token = token
end

Public Instance Methods

to_package() click to toggle source
# File lib/bmo/apns/notification.rb, line 93
def to_package
  [1, 32, token].pack('cnH64')
end
validate!() click to toggle source
# File lib/bmo/apns/notification.rb, line 97
def validate!
  unless token =~ /^[a-z0-9]{64}$/i
    fail(MalformedDeviceToken, "Malformed Device Token : #{token}")
  end
  true
end