Class: Verizon::ESIMRestErrorResponseException

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

Overview

eSIMRestErrorResponse class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ ESIMRestErrorResponseException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



23
24
25
26
27
# File 'lib/verizon/exceptions/esim_rest_error_response_exception.rb', line 23

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

Instance Attribute Details

#error_codeString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/verizon/exceptions/esim_rest_error_response_exception.rb', line 14

def error_code
  @error_code
end

#error_messageString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/verizon/exceptions/esim_rest_error_response_exception.rb', line 18

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



32
33
34
35
# File 'lib/verizon/exceptions/esim_rest_error_response_exception.rb', line 32

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