Exception: Bandwidth::GenericClientException
- Inherits:
-
APIException
- Object
- StandardError
- APIException
- Bandwidth::GenericClientException
- Defined in:
- lib/bandwidth/messaging_lib/messaging/exceptions/generic_client_exception.rb
Overview
GenericClientException class.
Instance Attribute Summary collapse
-
#description ⇒ String
TODO: Write general description for this method.
-
#field_errors ⇒ List of FieldError
TODO: Write general description for this method.
-
#type ⇒ String
TODO: Write general description for this method.
Attributes inherited from APIException
Instance Method Summary collapse
-
#initialize(reason, response) ⇒ GenericClientException
constructor
The constructor.
-
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash.
Constructor Details
#initialize(reason, response) ⇒ GenericClientException
The constructor.
24 25 26 27 28 |
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/generic_client_exception.rb', line 24 def initialize(reason, response) super(reason, response) hash = APIHelper.json_deserialize(@response.raw_body) unbox(hash) end |
Instance Attribute Details
#description ⇒ String
TODO: Write general description for this method
15 16 17 |
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/generic_client_exception.rb', line 15 def description @description end |
#field_errors ⇒ List of FieldError
TODO: Write general description for this method
19 20 21 |
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/generic_client_exception.rb', line 19 def field_errors @field_errors end |
#type ⇒ String
TODO: Write general description for this method
11 12 13 |
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/generic_client_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.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/bandwidth/messaging_lib/messaging/exceptions/generic_client_exception.rb', line 33 def unbox(hash) @type = hash['type'] @description = hash['description'] # Parameter is an array, so we need to iterate through it @field_errors = nil unless hash['fieldErrors'].nil? @field_errors = [] hash['fieldErrors'].each do |structure| @field_errors << (FieldError.from_hash(structure) if structure) end end end |