Class: AdvancedBilling::SubscriptionAddCouponErrorException
- Inherits:
-
APIException
- Object
- CoreLibrary::ApiException
- APIException
- AdvancedBilling::SubscriptionAddCouponErrorException
- Defined in:
- lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb
Overview
Subscription Add Coupon Error class.
Instance Attribute Summary collapse
-
#codes ⇒ Array[String]
TODO: Write general description for this method.
-
#coupon_code ⇒ Array[String]
TODO: Write general description for this method.
-
#coupon_codes ⇒ Array[String]
TODO: Write general description for this method.
-
#subscription ⇒ Array[String]
TODO: Write general description for this method.
Instance Method Summary collapse
-
#initialize(reason, response) ⇒ SubscriptionAddCouponErrorException
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) ⇒ SubscriptionAddCouponErrorException
The constructor.
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
#codes ⇒ Array[String]
TODO: Write general description for this method
14 15 16 |
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 14 def codes @codes end |
#coupon_code ⇒ Array[String]
TODO: Write general description for this method
18 19 20 |
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 18 def coupon_code @coupon_code end |
#coupon_codes ⇒ Array[String]
TODO: Write general description for this method
22 23 24 |
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 22 def coupon_codes @coupon_codes end |
#subscription ⇒ Array[String]
TODO: Write general description for this method
26 27 28 |
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 26 def subscription @subscription end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
57 58 59 60 61 |
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 57 def inspect class_name = self.class.name.split('::').last "<#{class_name} codes: #{@codes.inspect}, coupon_code: #{@coupon_code.inspect},"\ " coupon_codes: #{@coupon_codes.inspect}, subscription: #{@subscription.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
50 51 52 53 54 |
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 50 def to_s class_name = self.class.name.split('::').last "<#{class_name} codes: #{@codes}, coupon_code: #{@coupon_code}, coupon_codes:"\ " #{@coupon_codes}, subscription: #{@subscription}>" end |
#unbox(hash) ⇒ Object
Populates this object by extracting properties from a hash. response body.
40 41 42 43 44 45 46 47 |
# File 'lib/advanced_billing/exceptions/subscription_add_coupon_error_exception.rb', line 40 def unbox(hash) return nil unless 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 |