Class: NewStoreApi::SignaturePlV1Dto
- Defined in:
- lib/new_store_api/models/signature_pl_v1_dto.rb
Overview
SignaturePlV1Dto Model.
Instance Attribute Summary collapse
-
#commands ⇒ Array[PosnetOnlineCommandLogV1Dto]
Commands and their responses.
-
#counters ⇒ PosnetOnlineCountersV1Dto
Counters after the transaction execution.
-
#serial_number ⇒ String
Unique serial number of the printer that executed the transaction.
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(commands = SKIP, counters = SKIP, serial_number = SKIP) ⇒ SignaturePlV1Dto
constructor
A new instance of SignaturePlV1Dto.
-
#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(commands = SKIP, counters = SKIP, serial_number = SKIP) ⇒ SignaturePlV1Dto
Returns a new instance of SignaturePlV1Dto.
47 48 49 50 51 |
# File 'lib/new_store_api/models/signature_pl_v1_dto.rb', line 47 def initialize(commands = SKIP, counters = SKIP, serial_number = SKIP) @commands = commands unless commands == SKIP @counters = counters unless counters == SKIP @serial_number = serial_number unless serial_number == SKIP end |
Instance Attribute Details
#commands ⇒ Array[PosnetOnlineCommandLogV1Dto]
Commands and their responses.
14 15 16 |
# File 'lib/new_store_api/models/signature_pl_v1_dto.rb', line 14 def commands @commands end |
#counters ⇒ PosnetOnlineCountersV1Dto
Counters after the transaction execution.
18 19 20 |
# File 'lib/new_store_api/models/signature_pl_v1_dto.rb', line 18 def counters @counters end |
#serial_number ⇒ String
Unique serial number of the printer that executed the transaction.
22 23 24 |
# File 'lib/new_store_api/models/signature_pl_v1_dto.rb', line 22 def serial_number @serial_number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/new_store_api/models/signature_pl_v1_dto.rb', line 54 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it commands = nil unless hash['commands'].nil? commands = [] hash['commands'].each do |structure| commands << (PosnetOnlineCommandLogV1Dto.from_hash(structure) if structure) end end commands = SKIP unless hash.key?('commands') counters = PosnetOnlineCountersV1Dto.from_hash(hash['counters']) if hash['counters'] serial_number = hash.key?('serial_number') ? hash['serial_number'] : SKIP # Create object from extracted values. SignaturePlV1Dto.new(commands, counters, serial_number) end |
.names ⇒ Object
A mapping from model property names to API property names.
25 26 27 28 29 30 31 |
# File 'lib/new_store_api/models/signature_pl_v1_dto.rb', line 25 def self.names @_hash = {} if @_hash.nil? @_hash['commands'] = 'commands' @_hash['counters'] = 'counters' @_hash['serial_number'] = 'serial_number' @_hash end |
.nullables ⇒ Object
An array for nullable fields
43 44 45 |
# File 'lib/new_store_api/models/signature_pl_v1_dto.rb', line 43 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
34 35 36 37 38 39 40 |
# File 'lib/new_store_api/models/signature_pl_v1_dto.rb', line 34 def self.optionals %w[ commands counters serial_number ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
79 80 81 82 83 84 85 |
# File 'lib/new_store_api/models/signature_pl_v1_dto.rb', line 79 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.
95 96 97 98 99 |
# File 'lib/new_store_api/models/signature_pl_v1_dto.rb', line 95 def inspect class_name = self.class.name.split('::').last "<#{class_name} commands: #{@commands.inspect}, counters: #{@counters.inspect},"\ " serial_number: #{@serial_number.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
88 89 90 91 92 |
# File 'lib/new_store_api/models/signature_pl_v1_dto.rb', line 88 def to_s class_name = self.class.name.split('::').last "<#{class_name} commands: #{@commands}, counters: #{@counters}, serial_number:"\ " #{@serial_number}>" end |