Class: NewStoreApi::TransactionMinV1Dto
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::TransactionMinV1Dto
- Defined in:
- lib/new_store_api/models/transaction_min_v1_dto.rb
Overview
TransactionMinV1Dto Model.
Instance Attribute Summary collapse
-
#country_code ⇒ String
TODO: Write general description for this method.
-
#id ⇒ String
Transaction ID.
-
#signature ⇒ Object
Transaction signature.
-
#state ⇒ TransactionStateEnum
Transaction signature.
-
#temporary_signature ⇒ Object
Temporary transaction signature.
-
#transaction_number ⇒ Integer
Sequential transaction number.
-
#transaction_series ⇒ String
Transaction series (if defined).
-
#type ⇒ F11nTransactionTypeEnum
Transaction series (if defined).
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(country_code = nil, id = nil, state = nil, temporary_signature = nil, transaction_number = nil, type = nil, signature = SKIP, transaction_series = SKIP) ⇒ TransactionMinV1Dto
constructor
A new instance of TransactionMinV1Dto.
-
#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(country_code = nil, id = nil, state = nil, temporary_signature = nil, transaction_number = nil, type = nil, signature = SKIP, transaction_series = SKIP) ⇒ TransactionMinV1Dto
Returns a new instance of TransactionMinV1Dto.
71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 71 def initialize(country_code = nil, id = nil, state = nil, temporary_signature = nil, transaction_number = nil, type = nil, signature = SKIP, transaction_series = SKIP) @country_code = country_code @id = id @signature = signature unless signature == SKIP @state = state @temporary_signature = temporary_signature @transaction_number = transaction_number @transaction_series = transaction_series unless transaction_series == SKIP @type = type end |
Instance Attribute Details
#country_code ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 14 def country_code @country_code end |
#id ⇒ String
Transaction ID.
18 19 20 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 18 def id @id end |
#signature ⇒ Object
Transaction signature.
22 23 24 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 22 def signature @signature end |
#state ⇒ TransactionStateEnum
Transaction signature.
26 27 28 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 26 def state @state end |
#temporary_signature ⇒ Object
Temporary transaction signature.
30 31 32 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 30 def temporary_signature @temporary_signature end |
#transaction_number ⇒ Integer
Sequential transaction number.
34 35 36 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 34 def transaction_number @transaction_number end |
#transaction_series ⇒ String
Transaction series (if defined).
38 39 40 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 38 def transaction_series @transaction_series end |
#type ⇒ F11nTransactionTypeEnum
Transaction series (if defined).
42 43 44 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 42 def type @type 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 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 85 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. country_code = hash.key?('country_code') ? hash['country_code'] : nil id = hash.key?('id') ? hash['id'] : nil state = hash.key?('state') ? hash['state'] : nil temporary_signature = hash.key?('temporary_signature') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:TransactionMinV1DtoTemporarySignature), hash['temporary_signature'] ) : nil transaction_number = hash.key?('transaction_number') ? hash['transaction_number'] : nil type = hash.key?('type') ? hash['type'] : nil signature = hash.key?('signature') ? APIHelper.deserialize_union_type( UnionTypeLookUp.get(:TransactionMinV1DtoSignature), hash['signature'] ) : SKIP transaction_series = hash.key?('transaction_series') ? hash['transaction_series'] : SKIP # Create object from extracted values. TransactionMinV1Dto.new(country_code, id, state, temporary_signature, transaction_number, type, signature, transaction_series) end |
.names ⇒ Object
A mapping from model property names to API property names.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 45 def self.names @_hash = {} if @_hash.nil? @_hash['country_code'] = 'country_code' @_hash['id'] = 'id' @_hash['signature'] = 'signature' @_hash['state'] = 'state' @_hash['temporary_signature'] = 'temporary_signature' @_hash['transaction_number'] = 'transaction_number' @_hash['transaction_series'] = 'transaction_series' @_hash['type'] = 'type' @_hash end |
.nullables ⇒ Object
An array for nullable fields
67 68 69 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 67 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
59 60 61 62 63 64 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 59 def self.optionals %w[ signature transaction_series ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 117 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.country_code, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.state, ->(val) { TransactionStateEnum.validate(val) }) and UnionTypeLookUp.get(:TransactionMinV1DtoTemporarySignature) .validate(value.temporary_signature) and APIHelper.valid_type?(value.transaction_number, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.type, ->(val) { F11nTransactionTypeEnum.validate(val) }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['country_code'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['state'], ->(val) { TransactionStateEnum.validate(val) }) and UnionTypeLookUp.get(:TransactionMinV1DtoTemporarySignature) .validate(value['temporary_signature']) and APIHelper.valid_type?(value['transaction_number'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['type'], ->(val) { F11nTransactionTypeEnum.validate(val) }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
162 163 164 165 166 167 168 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 162 def inspect class_name = self.class.name.split('::').last "<#{class_name} country_code: #{@country_code.inspect}, id: #{@id.inspect}, signature:"\ " #{@signature.inspect}, state: #{@state.inspect}, temporary_signature:"\ " #{@temporary_signature.inspect}, transaction_number: #{@transaction_number.inspect},"\ " transaction_series: #{@transaction_series.inspect}, type: #{@type.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
154 155 156 157 158 159 |
# File 'lib/new_store_api/models/transaction_min_v1_dto.rb', line 154 def to_s class_name = self.class.name.split('::').last "<#{class_name} country_code: #{@country_code}, id: #{@id}, signature: #{@signature},"\ " state: #{@state}, temporary_signature: #{@temporary_signature}, transaction_number:"\ " #{@transaction_number}, transaction_series: #{@transaction_series}, type: #{@type}>" end |