Class: UnivapayClientSdk::SubscriptionUpdateScheduleSettings

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb

Overview

Schedule settings that can be updated on a subscription.

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(termination_mode: SubscriptionTerminationMode::IMMEDIATE, start_on: SKIP, preserve_end_of_month: SKIP, retry_interval: SKIP, additional_properties: nil) ⇒ SubscriptionUpdateScheduleSettings

Returns a new instance of SubscriptionUpdateScheduleSettings.



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb', line 58

def initialize(termination_mode: SubscriptionTerminationMode::IMMEDIATE,
               start_on: SKIP, preserve_end_of_month: SKIP,
               retry_interval: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @termination_mode = termination_mode unless termination_mode == SKIP
  @start_on = start_on unless start_on == SKIP
  @preserve_end_of_month = preserve_end_of_month unless preserve_end_of_month == SKIP
  @retry_interval = retry_interval unless retry_interval == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#preserve_end_of_monthTrueClass | FalseClass

If true, subsequent charges will always occur on the last day of the month.

Returns:

  • (TrueClass | FalseClass)


26
27
28
# File 'lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb', line 26

def preserve_end_of_month
  @preserve_end_of_month
end

#retry_intervalString

ISO-8601 Duration for retry interval if payment fails (e.g., P3D for 3 days, PT48H for 48 hours).

Returns:

  • (String)


31
32
33
# File 'lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb', line 31

def retry_interval
  @retry_interval
end

#start_onDate

Subscription start date (YYYY-MM-DD). Used to change the first actual charge date for subscriptions that initially only registered a payment method. Must be in the future; only available before the subscription has more than one paid payment.

Returns:

  • (Date)


21
22
23
# File 'lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb', line 21

def start_on
  @start_on
end

#termination_modeSubscriptionTerminationMode

Subscription Termination Mode schema.



14
15
16
# File 'lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb', line 14

def termination_mode
  @termination_mode
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  termination_mode =
    hash['termination_mode'] ||= SubscriptionTerminationMode::IMMEDIATE
  start_on = hash.key?('start_on') ? hash['start_on'] : SKIP
  preserve_end_of_month =
    hash.key?('preserve_end_of_month') ? hash['preserve_end_of_month'] : SKIP
  retry_interval =
    hash.key?('retry_interval') ? hash['retry_interval'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  SubscriptionUpdateScheduleSettings.new(termination_mode: termination_mode,
                                         start_on: start_on,
                                         preserve_end_of_month: preserve_end_of_month,
                                         retry_interval: retry_interval,
                                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
# File 'lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['termination_mode'] = 'termination_mode'
  @_hash['start_on'] = 'start_on'
  @_hash['preserve_end_of_month'] = 'preserve_end_of_month'
  @_hash['retry_interval'] = 'retry_interval'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
# File 'lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb', line 44

def self.optionals
  %w[
    termination_mode
    start_on
    preserve_end_of_month
    retry_interval
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



108
109
110
111
112
113
114
# File 'lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb', line 108

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} termination_mode: #{@termination_mode.inspect}, start_on:"\
  " #{@start_on.inspect}, preserve_end_of_month: #{@preserve_end_of_month.inspect},"\
  " retry_interval: #{@retry_interval.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



100
101
102
103
104
105
# File 'lib/univapay_client_sdk/models/subscription_update_schedule_settings.rb', line 100

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} termination_mode: #{@termination_mode}, start_on: #{@start_on},"\
  " preserve_end_of_month: #{@preserve_end_of_month}, retry_interval: #{@retry_interval},"\
  " additional_properties: #{@additional_properties}>"
end