Class: NewStoreApi::SignatureResponseV1Dto
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::SignatureResponseV1Dto
- Defined in:
- lib/new_store_api/models/signature_response_v1_dto.rb
Overview
SignatureResponseV1Dto Model.
Instance Attribute Summary collapse
-
#context ⇒ ContextV1Dto
Context.
-
#country_code ⇒ String
Context.
-
#created_at ⇒ DateTime
Signature creation timestamp to be used on the receipt.
-
#external_order_id ⇒ String
Sales order identifier used in external system.
-
#fiscal_mode ⇒ FiscalModeEnum
Sales order identifier used in external system.
-
#id ⇒ String
ID (idempotency key).
-
#original_created_at ⇒ String
Transaction creation timestamp.
-
#reference_order_id ⇒ String
ID of a reference order (e.g. referencing an original order).
-
#signature_strategy_override ⇒ TransactionSignatureStrategyEnum
ID of a reference order (e.g. referencing an original order).
-
#state ⇒ OrderManagementStateEnum
ID of a reference order (e.g. referencing an original order).
-
#tax_method ⇒ F11nTaxMethodEnum
ID of a reference order (e.g. referencing an original order).
-
#transactions ⇒ Array[TransactionMinV1Dto]
ID of a reference order (e.g. referencing an original order).
-
#updated_at ⇒ DateTime
Signature update timestamp.
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(context = nil, country_code = nil, created_at = nil, id = nil, state = nil, transactions = nil, updated_at = nil, external_order_id = SKIP, fiscal_mode = SKIP, original_created_at = SKIP, reference_order_id = SKIP, signature_strategy_override = SKIP, tax_method = SKIP) ⇒ SignatureResponseV1Dto
constructor
A new instance of SignatureResponseV1Dto.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ Object
- #to_custom_updated_at ⇒ 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(context = nil, country_code = nil, created_at = nil, id = nil, state = nil, transactions = nil, updated_at = nil, external_order_id = SKIP, fiscal_mode = SKIP, original_created_at = SKIP, reference_order_id = SKIP, signature_strategy_override = SKIP, tax_method = SKIP) ⇒ SignatureResponseV1Dto
Returns a new instance of SignatureResponseV1Dto.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 102 def initialize(context = nil, country_code = nil, created_at = nil, id = nil, state = nil, transactions = nil, updated_at = nil, external_order_id = SKIP, fiscal_mode = SKIP, original_created_at = SKIP, reference_order_id = SKIP, signature_strategy_override = SKIP, tax_method = SKIP) @context = context @country_code = country_code @created_at = created_at @external_order_id = external_order_id unless external_order_id == SKIP @fiscal_mode = fiscal_mode unless fiscal_mode == SKIP @id = id @original_created_at = original_created_at unless original_created_at == SKIP @reference_order_id = reference_order_id unless reference_order_id == SKIP unless signature_strategy_override == SKIP @signature_strategy_override = signature_strategy_override end @state = state @tax_method = tax_method unless tax_method == SKIP @transactions = transactions @updated_at = updated_at end |
Instance Attribute Details
#context ⇒ ContextV1Dto
Context.
15 16 17 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 15 def context @context end |
#country_code ⇒ String
Context.
19 20 21 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 19 def country_code @country_code end |
#created_at ⇒ DateTime
Signature creation timestamp to be used on the receipt.
23 24 25 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 23 def created_at @created_at end |
#external_order_id ⇒ String
Sales order identifier used in external system.
27 28 29 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 27 def external_order_id @external_order_id end |
#fiscal_mode ⇒ FiscalModeEnum
Sales order identifier used in external system.
31 32 33 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 31 def fiscal_mode @fiscal_mode end |
#id ⇒ String
ID (idempotency key).
35 36 37 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 35 def id @id end |
#original_created_at ⇒ String
Transaction creation timestamp.
- If set, will override the fiscal transaction timestamp.
40 41 42 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 40 def original_created_at @original_created_at end |
#reference_order_id ⇒ String
ID of a reference order (e.g. referencing an original order).
44 45 46 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 44 def reference_order_id @reference_order_id end |
#signature_strategy_override ⇒ TransactionSignatureStrategyEnum
ID of a reference order (e.g. referencing an original order).
48 49 50 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 48 def signature_strategy_override @signature_strategy_override end |
#state ⇒ OrderManagementStateEnum
ID of a reference order (e.g. referencing an original order).
52 53 54 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 52 def state @state end |
#tax_method ⇒ F11nTaxMethodEnum
ID of a reference order (e.g. referencing an original order).
56 57 58 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 56 def tax_method @tax_method end |
#transactions ⇒ Array[TransactionMinV1Dto]
ID of a reference order (e.g. referencing an original order).
60 61 62 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 60 def transactions @transactions end |
#updated_at ⇒ DateTime
Signature update timestamp.
64 65 66 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 64 def updated_at @updated_at end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 126 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. context = ContextV1Dto.from_hash(hash['context']) if hash['context'] country_code = hash.key?('country_code') ? hash['country_code'] : nil created_at = if hash.key?('created_at') (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at']) end id = hash.key?('id') ? hash['id'] : nil state = hash.key?('state') ? hash['state'] : nil # Parameter is an array, so we need to iterate through it transactions = nil unless hash['transactions'].nil? transactions = [] hash['transactions'].each do |structure| transactions << (TransactionMinV1Dto.from_hash(structure) if structure) end end transactions = nil unless hash.key?('transactions') updated_at = if hash.key?('updated_at') (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at']) end external_order_id = hash.key?('external_order_id') ? hash['external_order_id'] : SKIP fiscal_mode = hash.key?('fiscal_mode') ? hash['fiscal_mode'] : SKIP original_created_at = hash.key?('original_created_at') ? hash['original_created_at'] : SKIP reference_order_id = hash.key?('reference_order_id') ? hash['reference_order_id'] : SKIP signature_strategy_override = hash.key?('signature_strategy_override') ? hash['signature_strategy_override'] : SKIP tax_method = hash.key?('tax_method') ? hash['tax_method'] : SKIP # Create object from extracted values. SignatureResponseV1Dto.new(context, country_code, created_at, id, state, transactions, updated_at, external_order_id, fiscal_mode, original_created_at, reference_order_id, signature_strategy_override, tax_method) end |
.names ⇒ Object
A mapping from model property names to API property names.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 67 def self.names @_hash = {} if @_hash.nil? @_hash['context'] = 'context' @_hash['country_code'] = 'country_code' @_hash['created_at'] = 'created_at' @_hash['external_order_id'] = 'external_order_id' @_hash['fiscal_mode'] = 'fiscal_mode' @_hash['id'] = 'id' @_hash['original_created_at'] = 'original_created_at' @_hash['reference_order_id'] = 'reference_order_id' @_hash['signature_strategy_override'] = 'signature_strategy_override' @_hash['state'] = 'state' @_hash['tax_method'] = 'tax_method' @_hash['transactions'] = 'transactions' @_hash['updated_at'] = 'updated_at' @_hash end |
.nullables ⇒ Object
An array for nullable fields
98 99 100 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 98 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 86 def self.optionals %w[ external_order_id fiscal_mode original_created_at reference_order_id signature_strategy_override tax_method ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
197 198 199 200 201 202 203 204 205 206 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 197 def inspect class_name = self.class.name.split('::').last "<#{class_name} context: #{@context.inspect}, country_code: #{@country_code.inspect},"\ " created_at: #{@created_at.inspect}, external_order_id: #{@external_order_id.inspect},"\ " fiscal_mode: #{@fiscal_mode.inspect}, id: #{@id.inspect}, original_created_at:"\ " #{@original_created_at.inspect}, reference_order_id: #{@reference_order_id.inspect},"\ " signature_strategy_override: #{@signature_strategy_override.inspect}, state:"\ " #{@state.inspect}, tax_method: #{@tax_method.inspect}, transactions:"\ " #{@transactions.inspect}, updated_at: #{@updated_at.inspect}>" end |
#to_custom_created_at ⇒ Object
177 178 179 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 177 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_custom_updated_at ⇒ Object
181 182 183 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 181 def to_custom_updated_at DateTimeHelper.to_rfc3339(updated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
186 187 188 189 190 191 192 193 194 |
# File 'lib/new_store_api/models/signature_response_v1_dto.rb', line 186 def to_s class_name = self.class.name.split('::').last "<#{class_name} context: #{@context}, country_code: #{@country_code}, created_at:"\ " #{@created_at}, external_order_id: #{@external_order_id}, fiscal_mode: #{@fiscal_mode},"\ " id: #{@id}, original_created_at: #{@original_created_at}, reference_order_id:"\ " #{@reference_order_id}, signature_strategy_override: #{@signature_strategy_override},"\ " state: #{@state}, tax_method: #{@tax_method}, transactions: #{@transactions}, updated_at:"\ " #{@updated_at}>" end |