Class: UnivapayClientSdk::SubscriptionPatchTokenRequest

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

Overview

Request body for updating the payment method (transaction token) of a subscription. The new token must belong to the same store, be active, and match the subscription's mode.

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(transaction_token_id:, additional_properties: nil) ⇒ SubscriptionPatchTokenRequest

Returns a new instance of SubscriptionPatchTokenRequest.



37
38
39
40
41
42
43
# File 'lib/univapay_client_sdk/models/subscription_patch_token_request.rb', line 37

def initialize(transaction_token_id:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @transaction_token_id = transaction_token_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#transaction_token_idUUID | String

The ID of the new transaction token to use for future subscription payments. Must be a recurring or subscription-type token for the same store.

Returns:

  • (UUID | String)


18
19
20
# File 'lib/univapay_client_sdk/models/subscription_patch_token_request.rb', line 18

def transaction_token_id
  @transaction_token_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/univapay_client_sdk/models/subscription_patch_token_request.rb', line 46

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'] : nil

  # 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.
  SubscriptionPatchTokenRequest.new(transaction_token_id: transaction_token_id,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
# File 'lib/univapay_client_sdk/models/subscription_patch_token_request.rb', line 21

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

.nullablesObject

An array for nullable fields



33
34
35
# File 'lib/univapay_client_sdk/models/subscription_patch_token_request.rb', line 33

def self.nullables
  []
end

.optionalsObject

An array for optional fields



28
29
30
# File 'lib/univapay_client_sdk/models/subscription_patch_token_request.rb', line 28

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



73
74
75
76
77
# File 'lib/univapay_client_sdk/models/subscription_patch_token_request.rb', line 73

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

#to_sObject

Provides a human-readable string representation of the object.



66
67
68
69
70
# File 'lib/univapay_client_sdk/models/subscription_patch_token_request.rb', line 66

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