Class: AdvancedBilling::ResumeOptions
- Defined in:
- lib/advanced_billing/models/resume_options.rb
Overview
ResumeOptions Model.
Instance Attribute Summary collapse
-
#forgive_balance ⇒ TrueClass | FalseClass
Indicates whether or not Chargify should clear the subscription’s existing balance before attempting to resume the subscription.
-
#require_resume ⇒ TrueClass | FalseClass
Chargify will only attempt to resume the subscription’s billing period.
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(require_resume: SKIP, forgive_balance: SKIP, additional_properties: {}) ⇒ ResumeOptions
constructor
A new instance of ResumeOptions.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(require_resume: SKIP, forgive_balance: SKIP, additional_properties: {}) ⇒ ResumeOptions
Returns a new instance of ResumeOptions.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/advanced_billing/models/resume_options.rb', line 45 def initialize(require_resume: SKIP, forgive_balance: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @require_resume = require_resume unless require_resume == SKIP @forgive_balance = forgive_balance unless forgive_balance == SKIP end |
Instance Attribute Details
#forgive_balance ⇒ TrueClass | FalseClass
Indicates whether or not Chargify should clear the subscription’s existing balance before attempting to resume the subscription. If subscription cannot be resumed, the balance will remain as it was before the attempt to resume was made.
22 23 24 |
# File 'lib/advanced_billing/models/resume_options.rb', line 22 def forgive_balance @forgive_balance end |
#require_resume ⇒ TrueClass | FalseClass
Chargify will only attempt to resume the subscription’s billing period. If not resumable, the subscription will be left in it’s current state.
15 16 17 |
# File 'lib/advanced_billing/models/resume_options.rb', line 15 def require_resume @require_resume end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/advanced_billing/models/resume_options.rb', line 57 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. require_resume = hash.key?('require_resume') ? hash['require_resume'] : SKIP forgive_balance = hash.key?('forgive_balance') ? hash['forgive_balance'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. ResumeOptions.new(require_resume: require_resume, forgive_balance: forgive_balance, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 |
# File 'lib/advanced_billing/models/resume_options.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['require_resume'] = 'require_resume' @_hash['forgive_balance'] = 'forgive_balance' @_hash end |
.nullables ⇒ Object
An array for nullable fields
41 42 43 |
# File 'lib/advanced_billing/models/resume_options.rb', line 41 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
33 34 35 36 37 38 |
# File 'lib/advanced_billing/models/resume_options.rb', line 33 def self.optionals %w[ require_resume forgive_balance ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
77 78 79 80 81 82 83 |
# File 'lib/advanced_billing/models/resume_options.rb', line 77 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |