Class: ApiReference::CancelSubscriptionParams
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ApiReference::CancelSubscriptionParams
- Defined in:
- lib/api_reference/models/cancel_subscription_params.rb
Overview
CancelSubscriptionParams Model.
Instance Attribute Summary collapse
-
#allow_invoice_credit_or_void ⇒ TrueClass | FalseClass
If false, this request will fail if it would void an issued invoice or create a credit note.
-
#cancel_option ⇒ CancelOption
Determines the timing of subscription cancellation.
-
#cancellation_date ⇒ DateTime
The date that the cancellation should take effect.
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(cancel_option:, cancellation_date: SKIP, allow_invoice_credit_or_void: true) ⇒ CancelSubscriptionParams
constructor
A new instance of CancelSubscriptionParams.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_cancellation_date ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(cancel_option:, cancellation_date: SKIP, allow_invoice_credit_or_void: true) ⇒ CancelSubscriptionParams
Returns a new instance of CancelSubscriptionParams.
53 54 55 56 57 58 59 60 61 |
# File 'lib/api_reference/models/cancel_subscription_params.rb', line 53 def initialize(cancel_option:, cancellation_date: SKIP, allow_invoice_credit_or_void: true) @cancel_option = cancel_option @cancellation_date = cancellation_date unless cancellation_date == SKIP unless allow_invoice_credit_or_void == SKIP @allow_invoice_credit_or_void = allow_invoice_credit_or_void end end |
Instance Attribute Details
#allow_invoice_credit_or_void ⇒ TrueClass | FalseClass
If false, this request will fail if it would void an issued invoice or create a credit note. Consider using this as a safety mechanism if you do not expect existing invoices to be changed.
26 27 28 |
# File 'lib/api_reference/models/cancel_subscription_params.rb', line 26 def allow_invoice_credit_or_void @allow_invoice_credit_or_void end |
#cancel_option ⇒ CancelOption
Determines the timing of subscription cancellation
15 16 17 |
# File 'lib/api_reference/models/cancel_subscription_params.rb', line 15 def cancel_option @cancel_option end |
#cancellation_date ⇒ DateTime
The date that the cancellation should take effect. This parameter can only
be passed if the cancel_option is requested_date.
20 21 22 |
# File 'lib/api_reference/models/cancel_subscription_params.rb', line 20 def cancellation_date @cancellation_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/api_reference/models/cancel_subscription_params.rb', line 64 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. cancel_option = hash.key?('cancel_option') ? hash['cancel_option'] : nil cancellation_date = if hash.key?('cancellation_date') (DateTimeHelper.from_rfc3339(hash['cancellation_date']) if hash['cancellation_date']) else SKIP end allow_invoice_credit_or_void = hash['allow_invoice_credit_or_void'] ||= true # Create object from extracted values. CancelSubscriptionParams.new(cancel_option: cancel_option, cancellation_date: cancellation_date, allow_invoice_credit_or_void: allow_invoice_credit_or_void) end |
.names ⇒ Object
A mapping from model property names to API property names.
29 30 31 32 33 34 35 |
# File 'lib/api_reference/models/cancel_subscription_params.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['cancel_option'] = 'cancel_option' @_hash['cancellation_date'] = 'cancellation_date' @_hash['allow_invoice_credit_or_void'] = 'allow_invoice_credit_or_void' @_hash end |
.nullables ⇒ Object
An array for nullable fields
46 47 48 49 50 51 |
# File 'lib/api_reference/models/cancel_subscription_params.rb', line 46 def self.nullables %w[ cancellation_date allow_invoice_credit_or_void ] end |
.optionals ⇒ Object
An array for optional fields
38 39 40 41 42 43 |
# File 'lib/api_reference/models/cancel_subscription_params.rb', line 38 def self.optionals %w[ cancellation_date allow_invoice_credit_or_void ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
95 96 97 98 99 100 |
# File 'lib/api_reference/models/cancel_subscription_params.rb', line 95 def inspect class_name = self.class.name.split('::').last "<#{class_name} cancel_option: #{@cancel_option.inspect}, cancellation_date:"\ " #{@cancellation_date.inspect}, allow_invoice_credit_or_void:"\ " #{@allow_invoice_credit_or_void.inspect}>" end |
#to_custom_cancellation_date ⇒ Object
83 84 85 |
# File 'lib/api_reference/models/cancel_subscription_params.rb', line 83 def to_custom_cancellation_date DateTimeHelper.to_rfc3339(cancellation_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
88 89 90 91 92 |
# File 'lib/api_reference/models/cancel_subscription_params.rb', line 88 def to_s class_name = self.class.name.split('::').last "<#{class_name} cancel_option: #{@cancel_option}, cancellation_date: #{@cancellation_date},"\ " allow_invoice_credit_or_void: #{@allow_invoice_credit_or_void}>" end |