Class: AdvancedBilling::EventBasedBillingSegmentErrorsException

Inherits:
APIException
  • Object
show all
Defined in:
lib/advanced_billing/exceptions/event_based_billing_segment_errors_exception.rb

Overview

Event Based Billing Segment Errors class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ EventBasedBillingSegmentErrorsException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



22
23
24
25
26
# File 'lib/advanced_billing/exceptions/event_based_billing_segment_errors_exception.rb', line 22

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

Instance Attribute Details

#errorsHash[String, Object]

The key of the object would be a number (an index in the request array) where the error occurred. In the value object, the key represents the field and the value is an array with error messages. In most cases, this object would contain just one key.

Returns:

  • (Hash[String, Object])


17
18
19
# File 'lib/advanced_billing/exceptions/event_based_billing_segment_errors_exception.rb', line 17

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



31
32
33
# File 'lib/advanced_billing/exceptions/event_based_billing_segment_errors_exception.rb', line 31

def unbox(hash)
  @errors = hash.key?('errors') ? hash['errors'] : SKIP
end