class Grocer::FailedDeliveryAttempt

Constants

LENGTH

Attributes

device_token[RW]
timestamp[RW]

Public Class Methods

new(binary_tuple) click to toggle source
# File lib/grocer/failed_delivery_attempt.rb, line 7
def initialize(binary_tuple)
  # N   =>  4 byte timestamp
  # n   =>  2 byte token_length
  # H64 => 32 byte device_token
  seconds, _, @device_token = binary_tuple.unpack('NnH64')
  raise InvalidFormatError unless seconds && @device_token
  @timestamp = Time.at(seconds)
end