Class: Verizon::DeviceDiagnosticsResultException

Inherits:
APIException
  • Object
show all
Defined in:
lib/verizon/exceptions/device_diagnostics_result_exception.rb

Overview

All error messages are returned in this format. Error codes and messages are listed on the Error Codes page, along with explanations and suggestions for corrective actions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ DeviceDiagnosticsResultException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



25
26
27
28
29
# File 'lib/verizon/exceptions/device_diagnostics_result_exception.rb', line 25

def initialize(reason, response)
  super(reason, response)
  hash = APIHelper.json_deserialize(@response.raw_body)
  unbox(hash)
end

Instance Attribute Details

#error_codeString

Simple error code.

Returns:

  • (String)


16
17
18
# File 'lib/verizon/exceptions/device_diagnostics_result_exception.rb', line 16

def error_code
  @error_code
end

#error_messageString

Detailed error message.

Returns:

  • (String)


20
21
22
# File 'lib/verizon/exceptions/device_diagnostics_result_exception.rb', line 20

def error_message
  @error_message
end

Instance Method Details

#unbox(hash) ⇒ Object

Populates this object by extracting properties from a hash. response body.

Parameters:

  • The (Hash)

    deserialized response sent by the server in the



34
35
36
37
# File 'lib/verizon/exceptions/device_diagnostics_result_exception.rb', line 34

def unbox(hash)
  @error_code = hash.key?('errorCode') ? hash['errorCode'] : nil
  @error_message = hash.key?('errorMessage') ? hash['errorMessage'] : nil
end