Class: UnivapayClientSdk::SubscriptionUpdateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::SubscriptionUpdateRequest
- Defined in:
- lib/univapay_client_sdk/models/subscription_update_request.rb
Overview
Request payload for updating a subscription.
Instance Attribute Summary collapse
-
#amount ⇒ Integer
The recurring charge amount (applied to the cycle after the next one).
-
#metadata ⇒ GenericMetadata
A free-form dictionary for custom metadata.
-
#next_payment ⇒ SubscriptionUpdateNextPayment
Fields that can be updated on the next scheduled payment.
-
#schedule_settings ⇒ SubscriptionUpdateScheduleSettings
Schedule settings that can be updated on a subscription.
-
#status ⇒ SubscriptionUpdateStatus
Update the subscription status.
-
#transaction_token_id ⇒ UUID | String
Transaction token ID used for the subscription.
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(transaction_token_id: SKIP, amount: SKIP, metadata: SKIP, status: SKIP, schedule_settings: SKIP, next_payment: SKIP, additional_properties: nil) ⇒ SubscriptionUpdateRequest
constructor
A new instance of SubscriptionUpdateRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#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(transaction_token_id: SKIP, amount: SKIP, metadata: SKIP, status: SKIP, schedule_settings: SKIP, next_payment: SKIP, additional_properties: nil) ⇒ SubscriptionUpdateRequest
Returns a new instance of SubscriptionUpdateRequest.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 70 def initialize(transaction_token_id: SKIP, amount: SKIP, metadata: SKIP, status: SKIP, schedule_settings: SKIP, next_payment: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @transaction_token_id = transaction_token_id unless transaction_token_id == SKIP @amount = amount unless amount == SKIP @metadata = unless == SKIP @status = status unless status == SKIP @schedule_settings = schedule_settings unless schedule_settings == SKIP @next_payment = next_payment unless next_payment == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#amount ⇒ Integer
The recurring charge amount (applied to the cycle after the next one).
Not available for limited-cycle subscriptions. To change the immediate
next payment amount, update next_payment.amount instead.
22 23 24 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 22 def amount @amount end |
#metadata ⇒ GenericMetadata
A free-form dictionary for custom metadata.
26 27 28 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 26 def @metadata end |
#next_payment ⇒ SubscriptionUpdateNextPayment
Fields that can be updated on the next scheduled payment.
39 40 41 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 39 def next_payment @next_payment end |
#schedule_settings ⇒ SubscriptionUpdateScheduleSettings
Schedule settings that can be updated on a subscription.
35 36 37 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 35 def schedule_settings @schedule_settings end |
#status ⇒ SubscriptionUpdateStatus
Update the subscription status. suspended: Pause the subscription.
unpaid: Resume a suspended subscription.
31 32 33 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 31 def status @status end |
#transaction_token_id ⇒ UUID | String
Transaction token ID used for the subscription. Can be changed to update
the payment method (e.g., when a card expires). Allowed only when the
status is unconfirmed, unpaid, current, or suspended.
16 17 18 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 16 def transaction_token_id @transaction_token_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 86 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. transaction_token_id = hash.key?('transaction_token_id') ? hash['transaction_token_id'] : SKIP amount = hash.key?('amount') ? hash['amount'] : SKIP = GenericMetadata.from_hash(hash['metadata']) if hash['metadata'] status = hash.key?('status') ? hash['status'] : SKIP schedule_settings = SubscriptionUpdateScheduleSettings.from_hash(hash['schedule_settings']) if hash['schedule_settings'] next_payment = SubscriptionUpdateNextPayment.from_hash(hash['next_payment']) if hash['next_payment'] # 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. SubscriptionUpdateRequest.new(transaction_token_id: transaction_token_id, amount: amount, metadata: , status: status, schedule_settings: schedule_settings, next_payment: next_payment, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['transaction_token_id'] = 'transaction_token_id' @_hash['amount'] = 'amount' @_hash['metadata'] = 'metadata' @_hash['status'] = 'status' @_hash['schedule_settings'] = 'schedule_settings' @_hash['next_payment'] = 'next_payment' @_hash end |
.nullables ⇒ Object
An array for nullable fields
66 67 68 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 66 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 54 def self.optionals %w[ transaction_token_id amount metadata status schedule_settings next_payment ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
126 127 128 129 130 131 132 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 126 def inspect class_name = self.class.name.split('::').last "<#{class_name} transaction_token_id: #{@transaction_token_id.inspect}, amount:"\ " #{@amount.inspect}, metadata: #{@metadata.inspect}, status: #{@status.inspect},"\ " schedule_settings: #{@schedule_settings.inspect}, next_payment: #{@next_payment.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
118 119 120 121 122 123 |
# File 'lib/univapay_client_sdk/models/subscription_update_request.rb', line 118 def to_s class_name = self.class.name.split('::').last "<#{class_name} transaction_token_id: #{@transaction_token_id}, amount: #{@amount},"\ " metadata: #{@metadata}, status: #{@status}, schedule_settings: #{@schedule_settings},"\ " next_payment: #{@next_payment}, additional_properties: #{@additional_properties}>" end |