Exception: Bandwidth::AccountsTnlookup400ErrorException

Inherits:
APIException
  • Object
show all
Defined in:
lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb

Overview

Accounts Tnlookup 400 Error class.

Instance Attribute Summary collapse

Attributes inherited from APIException

#response, #response_code

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ AccountsTnlookup400ErrorException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



19
20
21
22
23
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb', line 19

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

Instance Attribute Details

#messageString

A description of what validation error occurred.

Returns:

  • (String)


14
15
16
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb', line 14

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



28
29
30
# File 'lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb', line 28

def unbox(hash)
  @message = hash.key?('message') ? hash['message'] : SKIP
end