Class: UnivapayClientSdk::TransactionTokenCreateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::TransactionTokenCreateRequest
- Defined in:
- lib/univapay_client_sdk/models/transaction_token_create_request.rb
Overview
TransactionTokenCreateRequest Model.
Instance Attribute Summary collapse
-
#data ⇒ Object
Transaction Token Create Request Data schema.
-
#email ⇒ String
Customer email address.
-
#ip_address ⇒ String
Consumer's IPv4 address.
-
#metadata ⇒ TransactionTokenCreateRequestMetadata
A free-form dictionary for custom metadata.
-
#payment_type ⇒ TransactionTokenCreateRequestPaymentType
Transaction Token Create Request Payment Type schema.
-
#type ⇒ TransactionTokenCreateRequestType
Transaction Token Create Request Type schema.
-
#usage_limit ⇒ String
Usage limit applied to the token.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(payment_type:, type:, data:, email: SKIP, usage_limit: SKIP, ip_address: SKIP, metadata: SKIP, additional_properties: nil) ⇒ TransactionTokenCreateRequest
constructor
A new instance of TransactionTokenCreateRequest.
-
#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(payment_type:, type:, data:, email: SKIP, usage_limit: SKIP, ip_address: SKIP, metadata: SKIP, additional_properties: nil) ⇒ TransactionTokenCreateRequest
Returns a new instance of TransactionTokenCreateRequest.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 69 def initialize(payment_type:, type:, data:, email: SKIP, usage_limit: SKIP, ip_address: SKIP, metadata: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @payment_type = payment_type @type = type @email = email unless email == SKIP @usage_limit = usage_limit unless usage_limit == SKIP @ip_address = ip_address unless ip_address == SKIP @metadata = unless == SKIP @data = data @additional_properties = additional_properties end |
Instance Attribute Details
#data ⇒ Object
Transaction Token Create Request Data schema.
39 40 41 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 39 def data @data end |
#email ⇒ String
Customer email address.
22 23 24 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 22 def email @email end |
#ip_address ⇒ String
Consumer's IPv4 address. Required when data.brand is
we_chat_online and data.call_method is web or http_get.
31 32 33 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 31 def ip_address @ip_address end |
#metadata ⇒ TransactionTokenCreateRequestMetadata
A free-form dictionary for custom metadata.
35 36 37 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 35 def @metadata end |
#payment_type ⇒ TransactionTokenCreateRequestPaymentType
Transaction Token Create Request Payment Type schema.
14 15 16 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 14 def payment_type @payment_type end |
#type ⇒ TransactionTokenCreateRequestType
Transaction Token Create Request Type schema.
18 19 20 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 18 def type @type end |
#usage_limit ⇒ String
Usage limit applied to the token.
26 27 28 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 26 def usage_limit @usage_limit end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
85 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 116 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 85 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. payment_type = hash.key?('payment_type') ? hash['payment_type'] : nil type = hash.key?('type') ? hash['type'] : nil data = hash.key?('data') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:TransactionTokenCreateRequestData), hash['data'] ) : nil email = hash.key?('email') ? hash['email'] : SKIP usage_limit = hash.key?('usage_limit') ? hash['usage_limit'] : SKIP ip_address = hash.key?('ip_address') ? hash['ip_address'] : SKIP = TransactionTokenCreateRequestMetadata.from_hash(hash['metadata']) if hash['metadata'] # 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. TransactionTokenCreateRequest.new(payment_type: payment_type, type: type, data: data, email: email, usage_limit: usage_limit, ip_address: ip_address, metadata: , 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 52 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['payment_type'] = 'payment_type' @_hash['type'] = 'type' @_hash['email'] = 'email' @_hash['usage_limit'] = 'usage_limit' @_hash['ip_address'] = 'ip_address' @_hash['metadata'] = 'metadata' @_hash['data'] = 'data' @_hash end |
.nullables ⇒ Object
An array for nullable fields
65 66 67 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 65 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
55 56 57 58 59 60 61 62 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 55 def self.optionals %w[ email usage_limit ip_address metadata ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 120 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.payment_type, ->(val) { TransactionTokenCreateRequestPaymentType.validate(val) }) and APIHelper.valid_type?(value.type, ->(val) { TransactionTokenCreateRequestType.validate(val) }) and UnionTypeLookUp.get(:TransactionTokenCreateRequestData) .validate(value.data) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['payment_type'], ->(val) { TransactionTokenCreateRequestPaymentType.validate(val) }) and APIHelper.valid_type?(value['type'], ->(val) { TransactionTokenCreateRequestType.validate(val) }) and UnionTypeLookUp.get(:TransactionTokenCreateRequestData) .validate(value['data']) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
153 154 155 156 157 158 159 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 153 def inspect class_name = self.class.name.split('::').last "<#{class_name} payment_type: #{@payment_type.inspect}, type: #{@type.inspect}, email:"\ " #{@email.inspect}, usage_limit: #{@usage_limit.inspect}, ip_address:"\ " #{@ip_address.inspect}, metadata: #{@metadata.inspect}, data: #{@data.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
145 146 147 148 149 150 |
# File 'lib/univapay_client_sdk/models/transaction_token_create_request.rb', line 145 def to_s class_name = self.class.name.split('::').last "<#{class_name} payment_type: #{@payment_type}, type: #{@type}, email: #{@email},"\ " usage_limit: #{@usage_limit}, ip_address: #{@ip_address}, metadata: #{@metadata}, data:"\ " #{@data}, additional_properties: #{@additional_properties}>" end |