Class: IOSPN::Device

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/ios_push_notifications/device.rb

Instance Method Summary collapse

Instance Method Details

#saveObject

validates_format_of :token, :with => /^[a-z0-9]8s8s8s8s8s8s8s8$/



8
9
10
11
12
# File 'lib/ios_push_notifications/device.rb', line 8

def save
  self.last_registered_at = Time.now if self.last_registered_at.nil?
  self.token = self.token
  super()
end

#to_hexObject



30
31
32
# File 'lib/ios_push_notifications/device.rb', line 30

def to_hex
  [self.token.delete(' ')].pack('H*')
end