Class: AdvancedBilling::ComponentAllocationErrorException
- Inherits:
-
APIException
- Object
- CoreLibrary::ApiException
- APIException
- AdvancedBilling::ComponentAllocationErrorException
- Defined in:
- lib/advanced_billing/exceptions/component_allocation_error_exception.rb
Overview
Component Allocation Error class.
Instance Attribute Summary collapse
-
#errors ⇒ Array[ComponentAllocationErrorItem]
TODO: Write general description for this method.
Instance Method Summary collapse
-
#initialize(reason, response) ⇒ ComponentAllocationErrorException
constructor
The constructor.
-
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash.
Constructor Details
#initialize(reason, response) ⇒ ComponentAllocationErrorException
The constructor.
19 20 21 22 23 |
# File 'lib/advanced_billing/exceptions/component_allocation_error_exception.rb', line 19 def initialize(reason, response) super(reason, response) hash = APIHelper.json_deserialize(@response.raw_body) unbox(hash) end |
Instance Attribute Details
#errors ⇒ Array[ComponentAllocationErrorItem]
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/exceptions/component_allocation_error_exception.rb', line 14 def errors @errors end |
Instance Method Details
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash. response body.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/advanced_billing/exceptions/component_allocation_error_exception.rb', line 28 def unbox(hash) # Parameter is an array, so we need to iterate through it @errors = nil unless hash['errors'].nil? @errors = [] hash['errors'].each do |structure| @errors << (ComponentAllocationErrorItem.from_hash(structure) if structure) end end @errors = SKIP unless hash.key?('errors') end |