Class: LeadZeppelin::APNS::ErrorResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/lead_zeppelin/apns/error_response.rb

Constant Summary collapse

CODES =
{
  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',
  255 => 'None (unknown)'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(packet, notification = nil) ⇒ ErrorResponse

Returns a new instance of ErrorResponse.



19
20
21
22
23
# File 'lib/lead_zeppelin/apns/error_response.rb', line 19

def initialize(packet, notification=nil)
  command, @code, @identifier = packet.unpack 'ccA4'
  @message = CODES[@code]
  @notification = notification
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



17
18
19
# File 'lib/lead_zeppelin/apns/error_response.rb', line 17

def code
  @code
end

#identifierObject (readonly)

Returns the value of attribute identifier.



17
18
19
# File 'lib/lead_zeppelin/apns/error_response.rb', line 17

def identifier
  @identifier
end

#messageObject (readonly)

Returns the value of attribute message.



17
18
19
# File 'lib/lead_zeppelin/apns/error_response.rb', line 17

def message
  @message
end

#notificationObject (readonly)

Returns the value of attribute notification.



17
18
19
# File 'lib/lead_zeppelin/apns/error_response.rb', line 17

def notification
  @notification
end