Class: AdvancedBilling::ReactivateSubscriptionRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::ReactivateSubscriptionRequest
- Defined in:
- lib/advanced_billing/models/reactivate_subscription_request.rb
Overview
ReactivateSubscriptionRequest Model.
Instance Attribute Summary collapse
-
#calendar_billing ⇒ ReactivationBilling
These values are only applicable to subscriptions using calendar billing.
-
#coupon_code ⇒ String
The coupon code to be applied during reactivation.
-
#include_trial ⇒ TrueClass | FalseClass
If ‘true` is sent, the reactivated Subscription will include a trial if one is available.
-
#preserve_balance ⇒ TrueClass | FalseClass
If ‘true` is passed, the existing subscription balance will NOT be cleared/reset before adding the additional reactivation charges.
-
#resume ⇒ Object
If ‘true`, Chargify will attempt to resume the subscription’s billing period.
-
#use_credits_and_prepayments ⇒ TrueClass | FalseClass
If true is sent, Chargify will use service credits and prepayments upon reactivation.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(calendar_billing: SKIP, include_trial: SKIP, preserve_balance: SKIP, coupon_code: SKIP, use_credits_and_prepayments: SKIP, resume: SKIP, additional_properties: {}) ⇒ ReactivateSubscriptionRequest
constructor
A new instance of ReactivateSubscriptionRequest.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(calendar_billing: SKIP, include_trial: SKIP, preserve_balance: SKIP, coupon_code: SKIP, use_credits_and_prepayments: SKIP, resume: SKIP, additional_properties: {}) ⇒ ReactivateSubscriptionRequest
Returns a new instance of ReactivateSubscriptionRequest.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/advanced_billing/models/reactivate_subscription_request.rb', line 72 def initialize(calendar_billing: SKIP, include_trial: SKIP, preserve_balance: SKIP, coupon_code: SKIP, use_credits_and_prepayments: SKIP, resume: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @calendar_billing = calendar_billing unless calendar_billing == SKIP @include_trial = include_trial unless include_trial == SKIP @preserve_balance = preserve_balance unless preserve_balance == SKIP @coupon_code = coupon_code unless coupon_code == SKIP unless use_credits_and_prepayments == SKIP @use_credits_and_prepayments = use_credits_and_prepayments end @resume = resume unless resume == SKIP end |
Instance Attribute Details
#calendar_billing ⇒ ReactivationBilling
These values are only applicable to subscriptions using calendar billing
14 15 16 |
# File 'lib/advanced_billing/models/reactivate_subscription_request.rb', line 14 def calendar_billing @calendar_billing end |
#coupon_code ⇒ String
The coupon code to be applied during reactivation.
28 29 30 |
# File 'lib/advanced_billing/models/reactivate_subscription_request.rb', line 28 def coupon_code @coupon_code end |
#include_trial ⇒ TrueClass | FalseClass
If ‘true` is sent, the reactivated Subscription will include a trial if one is available. If `false` is sent, the trial period will be ignored.
19 20 21 |
# File 'lib/advanced_billing/models/reactivate_subscription_request.rb', line 19 def include_trial @include_trial end |
#preserve_balance ⇒ TrueClass | FalseClass
If ‘true` is passed, the existing subscription balance will NOT be cleared/reset before adding the additional reactivation charges.
24 25 26 |
# File 'lib/advanced_billing/models/reactivate_subscription_request.rb', line 24 def preserve_balance @preserve_balance end |
#resume ⇒ Object
If ‘true`, Chargify will attempt to resume the subscription’s billing period. if not resumable, the subscription will be reactivated with a new billing period. If ‘false`: Chargify will only attempt to reactivate the subscription.
41 42 43 |
# File 'lib/advanced_billing/models/reactivate_subscription_request.rb', line 41 def resume @resume end |
#use_credits_and_prepayments ⇒ TrueClass | FalseClass
If true is sent, Chargify will use service credits and prepayments upon reactivation. If false is sent, the service credits and prepayments will be ignored.
34 35 36 |
# File 'lib/advanced_billing/models/reactivate_subscription_request.rb', line 34 def use_credits_and_prepayments @use_credits_and_prepayments end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/advanced_billing/models/reactivate_subscription_request.rb', line 93 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. calendar_billing = ReactivationBilling.from_hash(hash['calendar_billing']) if hash['calendar_billing'] include_trial = hash.key?('include_trial') ? hash['include_trial'] : SKIP preserve_balance = hash.key?('preserve_balance') ? hash['preserve_balance'] : SKIP coupon_code = hash.key?('coupon_code') ? hash['coupon_code'] : SKIP use_credits_and_prepayments = hash.key?('use_credits_and_prepayments') ? hash['use_credits_and_prepayments'] : SKIP resume = hash.key?('resume') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:ReactivateSubscriptionRequestResume), hash['resume'] ) : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. ReactivateSubscriptionRequest.new(calendar_billing: calendar_billing, include_trial: include_trial, preserve_balance: preserve_balance, coupon_code: coupon_code, use_credits_and_prepayments: use_credits_and_prepayments, resume: resume, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/advanced_billing/models/reactivate_subscription_request.rb', line 44 def self.names @_hash = {} if @_hash.nil? @_hash['calendar_billing'] = 'calendar_billing' @_hash['include_trial'] = 'include_trial' @_hash['preserve_balance'] = 'preserve_balance' @_hash['coupon_code'] = 'coupon_code' @_hash['use_credits_and_prepayments'] = 'use_credits_and_prepayments' @_hash['resume'] = 'resume' @_hash end |
.nullables ⇒ Object
An array for nullable fields
68 69 70 |
# File 'lib/advanced_billing/models/reactivate_subscription_request.rb', line 68 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/advanced_billing/models/reactivate_subscription_request.rb', line 56 def self.optionals %w[ calendar_billing include_trial preserve_balance coupon_code use_credits_and_prepayments resume ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
124 125 126 127 128 129 130 |
# File 'lib/advanced_billing/models/reactivate_subscription_request.rb', line 124 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |