Class: UnivapayClientSdk::TransactionTokenBase
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UnivapayClientSdk::TransactionTokenBase
- Defined in:
- lib/univapay_client_sdk/models/transaction_token_base.rb
Overview
Fields common to every stored transaction token, regardless of payment type.
Deliberately excludes payment_type and data — each concrete payment type
layers those on top with data pinned to its own shape; see
TransactionToken for the discriminated union that ties them together.
Instance Attribute Summary collapse
-
#active ⇒ TrueClass | FalseClass
Whether the resource is active.
-
#confirmed ⇒ TrueClass | FalseClass
Whether the token has been confirmed.
-
#created_on ⇒ DateTime
Timestamp when the resource was created.
-
#email ⇒ String
Customer email address.
-
#id ⇒ UUID | String
Unique identifier.
-
#last_used_on ⇒ DateTime
Timestamp when the token was last used.
-
#metadata ⇒ Hash[String, Object]
Arbitrary key-value metadata.
-
#mode ⇒ TransactionTokenMode
Transaction Token Mode schema.
-
#store_id ⇒ UUID | String
Store identifier.
-
#type ⇒ TransactionTokenType
Transaction Token Type schema.
-
#updated_on ⇒ DateTime
Timestamp when the resource was last updated.
-
#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(id: SKIP, store_id: SKIP, email: SKIP, active: SKIP, mode: SKIP, type: SKIP, usage_limit: SKIP, confirmed: SKIP, metadata: SKIP, created_on: SKIP, updated_on: SKIP, last_used_on: SKIP, additional_properties: nil) ⇒ TransactionTokenBase
constructor
A new instance of TransactionTokenBase.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_on ⇒ Object
- #to_custom_last_used_on ⇒ Object
- #to_custom_updated_on ⇒ Object
-
#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(id: SKIP, store_id: SKIP, email: SKIP, active: SKIP, mode: SKIP, type: SKIP, usage_limit: SKIP, confirmed: SKIP, metadata: SKIP, created_on: SKIP, updated_on: SKIP, last_used_on: SKIP, additional_properties: nil) ⇒ TransactionTokenBase
Returns a new instance of TransactionTokenBase.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 110 def initialize(id: SKIP, store_id: SKIP, email: SKIP, active: SKIP, mode: SKIP, type: SKIP, usage_limit: SKIP, confirmed: SKIP, metadata: SKIP, created_on: SKIP, updated_on: SKIP, last_used_on: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @id = id unless id == SKIP @store_id = store_id unless store_id == SKIP @email = email unless email == SKIP @active = active unless active == SKIP @mode = mode unless mode == SKIP @type = type unless type == SKIP @usage_limit = usage_limit unless usage_limit == SKIP @confirmed = confirmed unless confirmed == SKIP @metadata = unless == SKIP @created_on = created_on unless created_on == SKIP @updated_on = updated_on unless updated_on == SKIP @last_used_on = last_used_on unless last_used_on == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#active ⇒ TrueClass | FalseClass
Whether the resource is active.
30 31 32 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 30 def active @active end |
#confirmed ⇒ TrueClass | FalseClass
Whether the token has been confirmed.
46 47 48 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 46 def confirmed @confirmed end |
#created_on ⇒ DateTime
Timestamp when the resource was created.
54 55 56 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 54 def created_on @created_on end |
#email ⇒ String
Customer email address.
26 27 28 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 26 def email @email end |
#id ⇒ UUID | String
Unique identifier.
18 19 20 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 18 def id @id end |
#last_used_on ⇒ DateTime
Timestamp when the token was last used.
62 63 64 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 62 def last_used_on @last_used_on end |
#metadata ⇒ Hash[String, Object]
Arbitrary key-value metadata.
50 51 52 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 50 def @metadata end |
#mode ⇒ TransactionTokenMode
Transaction Token Mode schema.
34 35 36 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 34 def mode @mode end |
#store_id ⇒ UUID | String
Store identifier.
22 23 24 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 22 def store_id @store_id end |
#type ⇒ TransactionTokenType
Transaction Token Type schema.
38 39 40 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 38 def type @type end |
#updated_on ⇒ DateTime
Timestamp when the resource was last updated.
58 59 60 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 58 def updated_on @updated_on end |
#usage_limit ⇒ String
Usage limit applied to the token.
42 43 44 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 42 def usage_limit @usage_limit end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 133 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP store_id = hash.key?('store_id') ? hash['store_id'] : SKIP email = hash.key?('email') ? hash['email'] : SKIP active = hash.key?('active') ? hash['active'] : SKIP mode = hash.key?('mode') ? hash['mode'] : SKIP type = hash.key?('type') ? hash['type'] : SKIP usage_limit = hash.key?('usage_limit') ? hash['usage_limit'] : SKIP confirmed = hash.key?('confirmed') ? hash['confirmed'] : SKIP = hash.key?('metadata') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:TransactionTokenMetadataAdditionalProperties), hash['metadata'] ) : SKIP created_on = if hash.key?('created_on') (DateTimeHelper.from_rfc3339(hash['created_on']) if hash['created_on']) else SKIP end updated_on = if hash.key?('updated_on') (DateTimeHelper.from_rfc3339(hash['updated_on']) if hash['updated_on']) else SKIP end last_used_on = if hash.key?('last_used_on') (DateTimeHelper.from_rfc3339(hash['last_used_on']) if hash['last_used_on']) else SKIP end # 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. TransactionTokenBase.new(id: id, store_id: store_id, email: email, active: active, mode: mode, type: type, usage_limit: usage_limit, confirmed: confirmed, metadata: , created_on: created_on, updated_on: updated_on, last_used_on: last_used_on, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 65 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['store_id'] = 'store_id' @_hash['email'] = 'email' @_hash['active'] = 'active' @_hash['mode'] = 'mode' @_hash['type'] = 'type' @_hash['usage_limit'] = 'usage_limit' @_hash['confirmed'] = 'confirmed' @_hash['metadata'] = 'metadata' @_hash['created_on'] = 'created_on' @_hash['updated_on'] = 'updated_on' @_hash['last_used_on'] = 'last_used_on' @_hash end |
.nullables ⇒ Object
An array for nullable fields
101 102 103 104 105 106 107 108 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 101 def self.nullables %w[ email usage_limit confirmed last_used_on ] end |
.optionals ⇒ Object
An array for optional fields
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 83 def self.optionals %w[ id store_id email active mode type usage_limit confirmed metadata created_on updated_on last_used_on ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
201 202 203 204 205 206 207 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 201 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
219 220 221 222 223 224 225 226 227 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 219 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, store_id: #{@store_id.inspect}, email:"\ " #{@email.inspect}, active: #{@active.inspect}, mode: #{@mode.inspect}, type:"\ " #{@type.inspect}, usage_limit: #{@usage_limit.inspect}, confirmed: #{@confirmed.inspect},"\ " metadata: #{@metadata.inspect}, created_on: #{@created_on.inspect}, updated_on:"\ " #{@updated_on.inspect}, last_used_on: #{@last_used_on.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_created_on ⇒ Object
187 188 189 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 187 def to_custom_created_on DateTimeHelper.to_rfc3339(created_on) end |
#to_custom_last_used_on ⇒ Object
195 196 197 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 195 def to_custom_last_used_on DateTimeHelper.to_rfc3339(last_used_on) end |
#to_custom_updated_on ⇒ Object
191 192 193 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 191 def to_custom_updated_on DateTimeHelper.to_rfc3339(updated_on) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
210 211 212 213 214 215 216 |
# File 'lib/univapay_client_sdk/models/transaction_token_base.rb', line 210 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, store_id: #{@store_id}, email: #{@email}, active: #{@active},"\ " mode: #{@mode}, type: #{@type}, usage_limit: #{@usage_limit}, confirmed: #{@confirmed},"\ " metadata: #{@metadata}, created_on: #{@created_on}, updated_on: #{@updated_on},"\ " last_used_on: #{@last_used_on}, additional_properties: #{@additional_properties}>" end |