Class: ApiReference::TriggerSubscriptionPhaseParams

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/api_reference/models/trigger_subscription_phase_params.rb

Overview

TriggerSubscriptionPhaseParams Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(effective_date: SKIP, allow_invoice_credit_or_void: true) ⇒ TriggerSubscriptionPhaseParams

Returns a new instance of TriggerSubscriptionPhaseParams.



47
48
49
50
51
52
53
# File 'lib/api_reference/models/trigger_subscription_phase_params.rb', line 47

def initialize(effective_date: SKIP, allow_invoice_credit_or_void: true)
  @effective_date = effective_date unless effective_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_voidTrueClass | 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.

Returns:

  • (TrueClass | FalseClass)


21
22
23
# File 'lib/api_reference/models/trigger_subscription_phase_params.rb', line 21

def allow_invoice_credit_or_void
  @allow_invoice_credit_or_void
end

#effective_dateDate

The date on which the phase change should take effect. If not provided, defaults to today in the customer's timezone.

Returns:

  • (Date)


15
16
17
# File 'lib/api_reference/models/trigger_subscription_phase_params.rb', line 15

def effective_date
  @effective_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/api_reference/models/trigger_subscription_phase_params.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  effective_date =
    hash.key?('effective_date') ? hash['effective_date'] : SKIP
  allow_invoice_credit_or_void =
    hash['allow_invoice_credit_or_void'] ||= true

  # Create object from extracted values.
  TriggerSubscriptionPhaseParams.new(effective_date: effective_date,
                                     allow_invoice_credit_or_void: allow_invoice_credit_or_void)
end

.namesObject

A mapping from model property names to API property names.



24
25
26
27
28
29
# File 'lib/api_reference/models/trigger_subscription_phase_params.rb', line 24

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['effective_date'] = 'effective_date'
  @_hash['allow_invoice_credit_or_void'] = 'allow_invoice_credit_or_void'
  @_hash
end

.nullablesObject

An array for nullable fields



40
41
42
43
44
45
# File 'lib/api_reference/models/trigger_subscription_phase_params.rb', line 40

def self.nullables
  %w[
    effective_date
    allow_invoice_credit_or_void
  ]
end

.optionalsObject

An array for optional fields



32
33
34
35
36
37
# File 'lib/api_reference/models/trigger_subscription_phase_params.rb', line 32

def self.optionals
  %w[
    effective_date
    allow_invoice_credit_or_void
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



78
79
80
81
82
# File 'lib/api_reference/models/trigger_subscription_phase_params.rb', line 78

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} effective_date: #{@effective_date.inspect}, allow_invoice_credit_or_void:"\
  " #{@allow_invoice_credit_or_void.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



71
72
73
74
75
# File 'lib/api_reference/models/trigger_subscription_phase_params.rb', line 71

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} effective_date: #{@effective_date}, allow_invoice_credit_or_void:"\
  " #{@allow_invoice_credit_or_void}>"
end