Exception: Bandwidth::InvalidRequestException

Inherits:
APIException
  • Object
show all
Defined in:
lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb

Overview

InvalidRequest class.

Instance Attribute Summary collapse

Attributes inherited from APIException

#response, #response_code

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ InvalidRequestException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



16
17
18
19
20
# File 'lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb', line 16

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

Instance Attribute Details

#resultString

An error message pertaining to what the issue could be

Returns:

  • (String)


11
12
13
# File 'lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb', line 11

def result
  @result
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



25
26
27
# File 'lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb', line 25

def unbox(hash)
  @result = hash['result']
end