Class: EventMachine::APN::ErrorResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/em-apn/error_response.rb

Constant Summary

DESCRIPTION =
{
  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 Method Summary (collapse)

Constructor Details

- (ErrorResponse) initialize(command, status_code, identifier)

A new instance of ErrorResponse



17
18
19
20
21
# File 'lib/em-apn/error_response.rb', line 17

def initialize(command, status_code, identifier)
  @command     = command
  @status_code = status_code
  @identifier  = identifier
end

Instance Method Details

- (Object) description



27
28
29
# File 'lib/em-apn/error_response.rb', line 27

def description
  DESCRIPTION[@status_code] || "Missing description"
end

- (Object) to_s



23
24
25
# File 'lib/em-apn/error_response.rb', line 23

def to_s
  "CODE=#{@status_code} ID=#{@identifier} DESC=#{description}"
end