Class: EventMachine::APN::ErrorResponse

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

Constant Summary collapse

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 Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, status_code, identifier) ⇒ ErrorResponse

Returns a new instance of ErrorResponse.



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

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

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



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

def command
  @command
end

#identifierObject (readonly)

Returns the value of attribute identifier.



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

def identifier
  @identifier
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



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

def status_code
  @status_code
end

Instance Method Details

#descriptionObject



29
30
31
# File 'lib/em-apn/error_response.rb', line 29

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

#to_sObject



25
26
27
# File 'lib/em-apn/error_response.rb', line 25

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