Class: AdvancedBilling::SubscriptionAddCouponErrorException

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

Overview

Subscription Add Coupon Error class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, response) ⇒ SubscriptionAddCouponErrorException

The constructor.

Parameters:

  • The (String)

    reason for raising an exception.

  • The (HttpResponse)

    HttpReponse of the API call.



31
32
33
34
35
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 31

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

Instance Attribute Details

#codesArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


14
15
16
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 14

def codes
  @codes
end

#coupon_codeArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


18
19
20
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 18

def coupon_code
  @coupon_code
end

#coupon_codesArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


22
23
24
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 22

def coupon_codes
  @coupon_codes
end

#subscriptionArray[String]

TODO: Write general description for this method

Returns:

  • (Array[String])


26
27
28
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 26

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



40
41
42
43
44
45
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 40

def unbox(hash)
  @codes = hash.key?('codes') ? hash['codes'] : SKIP
  @coupon_code = hash.key?('coupon_code') ? hash['coupon_code'] : SKIP
  @coupon_codes = hash.key?('coupon_codes') ? hash['coupon_codes'] : SKIP
  @subscription = hash.key?('subscription') ? hash['subscription'] : SKIP
end