Class: AdvancedBilling::SubscriptionComponentAllocationErrorException
- Inherits:
-
APIException
- Object
- CoreLibrary::ApiException
- APIException
- AdvancedBilling::SubscriptionComponentAllocationErrorException
- Defined in:
- lib/advanced_billing/exceptions/subscription_component_allocation_error_exception.rb
Overview
Subscription Component Allocation Error class.
Instance Attribute Summary collapse
-
#errors ⇒ Array[SubscriptionComponentAllocationErrorItem]
TODO: Write general description for this method.
Instance Method Summary collapse
-
#initialize(reason, response) ⇒ SubscriptionComponentAllocationErrorException
constructor
The constructor.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
-
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash.
Constructor Details
#initialize(reason, response) ⇒ SubscriptionComponentAllocationErrorException
The constructor.
19 20 21 22 23 |
# File 'lib/advanced_billing/exceptions/subscription_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[SubscriptionComponentAllocationErrorItem]
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/exceptions/subscription_component_allocation_error_exception.rb', line 14 def errors @errors end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
50 51 52 53 |
# File 'lib/advanced_billing/exceptions/subscription_component_allocation_error_exception.rb', line 50 def inspect class_name = self.class.name.split('::').last "<#{class_name} errors: #{@errors.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
44 45 46 47 |
# File 'lib/advanced_billing/exceptions/subscription_component_allocation_error_exception.rb', line 44 def to_s class_name = self.class.name.split('::').last "<#{class_name} errors: #{@errors}>" end |
#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 40 41 |
# File 'lib/advanced_billing/exceptions/subscription_component_allocation_error_exception.rb', line 28 def unbox(hash) return nil unless 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 << (SubscriptionComponentAllocationErrorItem.from_hash(structure) if structure) end end @errors = SKIP unless hash.key?('errors') end |