Class: EventMachine::ApnManager::ErrorResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/em_apn_manager/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.



21
22
23
24
25
# File 'lib/em_apn_manager/error_response.rb', line 21

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.



19
20
21
# File 'lib/em_apn_manager/error_response.rb', line 19

def command
  @command
end

#identifierObject (readonly)

Returns the value of attribute identifier.



19
20
21
# File 'lib/em_apn_manager/error_response.rb', line 19

def identifier
  @identifier
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



19
20
21
# File 'lib/em_apn_manager/error_response.rb', line 19

def status_code
  @status_code
end

Instance Method Details

#descriptionObject



31
32
33
# File 'lib/em_apn_manager/error_response.rb', line 31

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

#to_sObject



27
28
29
# File 'lib/em_apn_manager/error_response.rb', line 27

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