Class: NewStoreApi::SignatureItV1Dto
- Defined in:
- lib/new_store_api/models/signature_it_v1_dto.rb
Overview
SignatureItV1Dto Model.
Instance Attribute Summary collapse
-
#error ⇒ String
Error of the transaction executed by the fiscal printer.
-
#error_state ⇒ FiscalPrinterErrorStateEnum
Error of the transaction executed by the fiscal printer.
-
#id ⇒ String
Id of the transaction executed by the fiscal printer.
-
#metrics ⇒ Array[Object]
Metrics of remote command execution from the fiscal printer.
-
#return_receipt_result ⇒ FiscalReceiptResultV1Dto
Fiscal receipt result of the return transaction executed by the fiscal printer.
-
#sales_receipt_result ⇒ FiscalReceiptResultV1Dto
Fiscal receipt result of the sales transaction executed by the fiscal printer.
-
#serial_number ⇒ String
Fiscal printer serial number.
-
#successful ⇒ TrueClass | FalseClass
Flag that indicates if the transaction executed by the fiscal printer succeeded or not.
-
#transaction_number ⇒ String
Sequenced transaction number of the transaction executed by the fiscal printer.
-
#z_report_number ⇒ Integer
Z report number from the fiscal printer.
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 = nil, successful = nil, error = SKIP, error_state = SKIP, metrics = SKIP, return_receipt_result = SKIP, sales_receipt_result = SKIP, serial_number = SKIP, transaction_number = SKIP, z_report_number = SKIP) ⇒ SignatureItV1Dto
constructor
A new instance of SignatureItV1Dto.
-
#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(id = nil, successful = nil, error = SKIP, error_state = SKIP, metrics = SKIP, return_receipt_result = SKIP, sales_receipt_result = SKIP, serial_number = SKIP, transaction_number = SKIP, z_report_number = SKIP) ⇒ SignatureItV1Dto
Returns a new instance of SignatureItV1Dto.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 91 def initialize(id = nil, successful = nil, error = SKIP, error_state = SKIP, metrics = SKIP, return_receipt_result = SKIP, sales_receipt_result = SKIP, serial_number = SKIP, transaction_number = SKIP, z_report_number = SKIP) @error = error unless error == SKIP @error_state = error_state unless error_state == SKIP @id = id @metrics = metrics unless metrics == SKIP @return_receipt_result = return_receipt_result unless return_receipt_result == SKIP @sales_receipt_result = sales_receipt_result unless sales_receipt_result == SKIP @serial_number = serial_number unless serial_number == SKIP @successful = successful @transaction_number = transaction_number unless transaction_number == SKIP @z_report_number = z_report_number unless z_report_number == SKIP end |
Instance Attribute Details
#error ⇒ String
Error of the transaction executed by the fiscal printer.
14 15 16 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 14 def error @error end |
#error_state ⇒ FiscalPrinterErrorStateEnum
Error of the transaction executed by the fiscal printer.
18 19 20 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 18 def error_state @error_state end |
#id ⇒ String
Id of the transaction executed by the fiscal printer.
22 23 24 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 22 def id @id end |
#metrics ⇒ Array[Object]
Metrics of remote command execution from the fiscal printer.
26 27 28 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 26 def metrics @metrics end |
#return_receipt_result ⇒ FiscalReceiptResultV1Dto
Fiscal receipt result of the return transaction executed by the fiscal printer.
31 32 33 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 31 def return_receipt_result @return_receipt_result end |
#sales_receipt_result ⇒ FiscalReceiptResultV1Dto
Fiscal receipt result of the sales transaction executed by the fiscal printer.
36 37 38 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 36 def sales_receipt_result @sales_receipt_result end |
#serial_number ⇒ String
Fiscal printer serial number.
40 41 42 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 40 def serial_number @serial_number end |
#successful ⇒ TrueClass | FalseClass
Flag that indicates if the transaction executed by the fiscal printer succeeded or not.
45 46 47 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 45 def successful @successful end |
#transaction_number ⇒ String
Sequenced transaction number of the transaction executed by the fiscal printer.
50 51 52 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 50 def transaction_number @transaction_number end |
#z_report_number ⇒ Integer
Z report number from the fiscal printer.
54 55 56 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 54 def z_report_number @z_report_number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 108 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : nil successful = hash.key?('successful') ? hash['successful'] : nil error = hash.key?('error') ? hash['error'] : SKIP error_state = hash.key?('error_state') ? hash['error_state'] : SKIP metrics = hash.key?('metrics') ? hash['metrics'] : SKIP return_receipt_result = FiscalReceiptResultV1Dto.from_hash(hash['return_receipt_result']) if hash['return_receipt_result'] sales_receipt_result = FiscalReceiptResultV1Dto.from_hash(hash['sales_receipt_result']) if hash['sales_receipt_result'] serial_number = hash.key?('serial_number') ? hash['serial_number'] : SKIP transaction_number = hash.key?('transaction_number') ? hash['transaction_number'] : SKIP z_report_number = hash.key?('z_report_number') ? hash['z_report_number'] : SKIP # Create object from extracted values. SignatureItV1Dto.new(id, successful, error, error_state, metrics, return_receipt_result, sales_receipt_result, serial_number, transaction_number, z_report_number) end |
.names ⇒ Object
A mapping from model property names to API property names.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 57 def self.names @_hash = {} if @_hash.nil? @_hash['error'] = 'error' @_hash['error_state'] = 'error_state' @_hash['id'] = 'id' @_hash['metrics'] = 'metrics' @_hash['return_receipt_result'] = 'return_receipt_result' @_hash['sales_receipt_result'] = 'sales_receipt_result' @_hash['serial_number'] = 'serial_number' @_hash['successful'] = 'successful' @_hash['transaction_number'] = 'transaction_number' @_hash['z_report_number'] = 'z_report_number' @_hash end |
.nullables ⇒ Object
An array for nullable fields
87 88 89 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 87 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 73 def self.optionals %w[ error error_state metrics return_receipt_result sales_receipt_result serial_number transaction_number z_report_number ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 142 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.successful, ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['successful'], ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
172 173 174 175 176 177 178 179 180 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 172 def inspect class_name = self.class.name.split('::').last "<#{class_name} error: #{@error.inspect}, error_state: #{@error_state.inspect}, id:"\ " #{@id.inspect}, metrics: #{@metrics.inspect}, return_receipt_result:"\ " #{@return_receipt_result.inspect}, sales_receipt_result: #{@sales_receipt_result.inspect},"\ " serial_number: #{@serial_number.inspect}, successful: #{@successful.inspect},"\ " transaction_number: #{@transaction_number.inspect}, z_report_number:"\ " #{@z_report_number.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
163 164 165 166 167 168 169 |
# File 'lib/new_store_api/models/signature_it_v1_dto.rb', line 163 def to_s class_name = self.class.name.split('::').last "<#{class_name} error: #{@error}, error_state: #{@error_state}, id: #{@id}, metrics:"\ " #{@metrics}, return_receipt_result: #{@return_receipt_result}, sales_receipt_result:"\ " #{@sales_receipt_result}, serial_number: #{@serial_number}, successful: #{@successful},"\ " transaction_number: #{@transaction_number}, z_report_number: #{@z_report_number}>" end |