Class: AppleShove::APNS::ErrorResponsePacket

Inherits:
Object
  • Object
show all
Defined in:
lib/apple_shove/apns/error_response_packet.rb

Constant Summary collapse

STATUS_MESSAGES =
{ 0   => 'No errors encountered',
1   => 'Processing error',
2   => 'Missing device token',
3   => 'Missing topic',
4   => 'Missing payload',
5   => 'Invalid token size',
6   => 'Invalid topic size',
7   => 'Invalid payload size',
8   => 'Invalid token',
10  => 'Shotdown',
255 => 'None (unknown)' }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(binary_response) ⇒ ErrorResponsePacket

Returns a new instance of ErrorResponsePacket.



19
20
21
22
23
24
# File 'lib/apple_shove/apns/error_response_packet.rb', line 19

def initialize(binary_response)
  response = binary_response.unpack('CCA4')

  @status     = response[1]
  @identifier = response[2]
end

Instance Attribute Details

#identifierObject (readonly)

Returns the value of attribute identifier.



5
6
7
# File 'lib/apple_shove/apns/error_response_packet.rb', line 5

def identifier
  @identifier
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/apple_shove/apns/error_response_packet.rb', line 5

def status
  @status
end

Instance Method Details

#status_messageObject



26
27
28
# File 'lib/apple_shove/apns/error_response_packet.rb', line 26

def status_message
  STATUS_MESSAGES[@status]
end