Exception: Bandwidth::BandwidthException
- Inherits:
-
APIException
- Object
- StandardError
- APIException
- Bandwidth::BandwidthException
- Defined in:
- lib/bandwidth/voice_lib/voice/exceptions/bandwidth_exception.rb
Overview
BandwidthException 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.
-
#id ⇒ String
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) ⇒ BandwidthException
constructor
The constructor.
-
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash.
Constructor Details
#initialize(reason, response) ⇒ BandwidthException
The constructor.
28 29 30 31 32 |
# File 'lib/bandwidth/voice_lib/voice/exceptions/bandwidth_exception.rb', line 28 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/voice_lib/voice/exceptions/bandwidth_exception.rb', line 15 def description @description end |
#field_errors ⇒ List of FieldError
TODO: Write general description for this method
23 24 25 |
# File 'lib/bandwidth/voice_lib/voice/exceptions/bandwidth_exception.rb', line 23 def field_errors @field_errors end |
#id ⇒ String
TODO: Write general description for this method
19 20 21 |
# File 'lib/bandwidth/voice_lib/voice/exceptions/bandwidth_exception.rb', line 19 def id @id end |
#type ⇒ String
TODO: Write general description for this method
11 12 13 |
# File 'lib/bandwidth/voice_lib/voice/exceptions/bandwidth_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.
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/bandwidth/voice_lib/voice/exceptions/bandwidth_exception.rb', line 37 def unbox(hash) @type = hash['type'] @description = hash['description'] @id = hash['id'] # 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 |