Exception: Bandwidth::ErrorResponseException

Inherits:
APIException
  • Object
show all
Defined in:
lib/bandwidth/voice_lib/voice/exceptions/error_response_exception.rb

Overview

ErrorResponse class.

Instance Attribute Summary collapse

Attributes inherited from APIException

#response, #response_code

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ ErrorResponseException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



24
25
26
27
28
# File 'lib/bandwidth/voice_lib/voice/exceptions/error_response_exception.rb', line 24

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

Instance Attribute Details

#descriptionString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/bandwidth/voice_lib/voice/exceptions/error_response_exception.rb', line 15

def description
  @description
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/bandwidth/voice_lib/voice/exceptions/error_response_exception.rb', line 19

def id
  @id
end

#typeTypeEnum

TODO: Write general description for this method

Returns:



11
12
13
# File 'lib/bandwidth/voice_lib/voice/exceptions/error_response_exception.rb', line 11

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



33
34
35
36
37
# File 'lib/bandwidth/voice_lib/voice/exceptions/error_response_exception.rb', line 33

def unbox(hash)
  @type = hash['type']
  @description = hash['description']
  @id = hash['id']
end