Class: AdvancedBilling::CancellationOptions
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::CancellationOptions
- Defined in:
- lib/advanced_billing/models/cancellation_options.rb
Overview
CancellationOptions Model.
Instance Attribute Summary collapse
-
#cancellation_message ⇒ String
For your internal use.
-
#reason_code ⇒ String
The reason code associated with the cancellation.
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.
Instance Method Summary collapse
-
#initialize(cancellation_message: SKIP, reason_code: SKIP, additional_properties: {}) ⇒ CancellationOptions
constructor
A new instance of CancellationOptions.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(cancellation_message: SKIP, reason_code: SKIP, additional_properties: {}) ⇒ CancellationOptions
Returns a new instance of CancellationOptions.
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/advanced_billing/models/cancellation_options.rb', line 43 def initialize(cancellation_message: SKIP, reason_code: SKIP, additional_properties: {}) # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end @cancellation_message = unless == SKIP @reason_code = reason_code unless reason_code == SKIP end |
Instance Attribute Details
#cancellation_message ⇒ String
For your internal use. An indication as to why the subscription is being canceled.
15 16 17 |
# File 'lib/advanced_billing/models/cancellation_options.rb', line 15 def @cancellation_message end |
#reason_code ⇒ String
The reason code associated with the cancellation. See the list of reason codes associated with your site.
20 21 22 |
# File 'lib/advanced_billing/models/cancellation_options.rb', line 20 def reason_code @reason_code end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/advanced_billing/models/cancellation_options.rb', line 55 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. = hash.key?('cancellation_message') ? hash['cancellation_message'] : SKIP reason_code = hash.key?('reason_code') ? hash['reason_code'] : SKIP # Clean out expected properties from Hash. additional_properties = hash.reject { |k, _| names.value?(k) } # Create object from extracted values. CancellationOptions.new(cancellation_message: , reason_code: reason_code, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
23 24 25 26 27 28 |
# File 'lib/advanced_billing/models/cancellation_options.rb', line 23 def self.names @_hash = {} if @_hash.nil? @_hash['cancellation_message'] = 'cancellation_message' @_hash['reason_code'] = 'reason_code' @_hash end |
.nullables ⇒ Object
An array for nullable fields
39 40 41 |
# File 'lib/advanced_billing/models/cancellation_options.rb', line 39 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
31 32 33 34 35 36 |
# File 'lib/advanced_billing/models/cancellation_options.rb', line 31 def self.optionals %w[ cancellation_message reason_code ] end |