Exception: Bandwidth::PathClientException

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

Overview

PathClientException class.

Instance Attribute Summary collapse

Attributes inherited from APIException

#response, #response_code

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ PathClientException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



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

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

Instance Attribute Details

#errorString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/path_client_exception.rb', line 19

def error
  @error
end

#messageString

TODO: Write general description for this method

Returns:

  • (String)


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

def message
  @message
end

#pathString

TODO: Write general description for this method

Returns:

  • (String)


27
28
29
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/path_client_exception.rb', line 27

def path
  @path
end

#statusInteger

TODO: Write general description for this method

Returns:

  • (Integer)


15
16
17
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/path_client_exception.rb', line 15

def status
  @status
end

#timestampString

TODO: Write general description for this method

Returns:

  • (String)


11
12
13
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/path_client_exception.rb', line 11

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



41
42
43
44
45
46
47
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/path_client_exception.rb', line 41

def unbox(hash)
  @timestamp = hash['timestamp']
  @status = hash['status']
  @error = hash['error']
  @message = hash['message']
  @path = hash['path']
end