Exception: Bandwidth::MessagingException

Inherits:
APIException
  • Object
show all
Defined in:
lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb

Overview

MessagingException class.

Instance Attribute Summary collapse

Attributes inherited from APIException

#response, #response_code

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ MessagingException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



23
24
25
26
27
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb', line 23

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)


18
19
20
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb', line 18

def description
  @description
end

#typeString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb', line 14

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



32
33
34
35
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb', line 32

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