Class: NewStoreApi::SignatureNoV1Dto
- Defined in:
- lib/new_store_api/models/signature_no_v1_dto.rb
Overview
SignatureNoV1Dto Model.
Instance Attribute Summary collapse
-
#cash_register_id ⇒ String
Cash register identifier.
-
#digital_signature ⇒ String
Locally generated signature, part of the chain maintained in the e-journal.
-
#environment ⇒ FiscalEnvironmentEnum
Locally generated signature, part of the chain maintained in the e-journal.
-
#key_version ⇒ String
The RSA key version.
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(cash_register_id = nil, digital_signature = nil, environment = nil, key_version = nil) ⇒ SignatureNoV1Dto
constructor
A new instance of SignatureNoV1Dto.
-
#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(cash_register_id = nil, digital_signature = nil, environment = nil, key_version = nil) ⇒ SignatureNoV1Dto
Returns a new instance of SignatureNoV1Dto.
54 55 56 57 58 59 60 |
# File 'lib/new_store_api/models/signature_no_v1_dto.rb', line 54 def initialize(cash_register_id = nil, digital_signature = nil, environment = nil, key_version = nil) @cash_register_id = cash_register_id @digital_signature = digital_signature @environment = environment @key_version = key_version end |
Instance Attribute Details
#cash_register_id ⇒ String
Cash register identifier.
- The ID of the cash register is an auto-generated field and it should not be sent while creating a store.
- Following format is used for the auto-generated cash register
identifier:
{firstTwoCharactersOfTheTenant}-{storeId}
18 19 20 |
# File 'lib/new_store_api/models/signature_no_v1_dto.rb', line 18 def cash_register_id @cash_register_id end |
#digital_signature ⇒ String
Locally generated signature, part of the chain maintained in the e-journal.
23 24 25 |
# File 'lib/new_store_api/models/signature_no_v1_dto.rb', line 23 def digital_signature @digital_signature end |
#environment ⇒ FiscalEnvironmentEnum
Locally generated signature, part of the chain maintained in the e-journal.
28 29 30 |
# File 'lib/new_store_api/models/signature_no_v1_dto.rb', line 28 def environment @environment end |
#key_version ⇒ String
The RSA key version.
32 33 34 |
# File 'lib/new_store_api/models/signature_no_v1_dto.rb', line 32 def key_version @key_version end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/new_store_api/models/signature_no_v1_dto.rb', line 63 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. cash_register_id = hash.key?('cash_register_id') ? hash['cash_register_id'] : nil digital_signature = hash.key?('digital_signature') ? hash['digital_signature'] : nil environment = hash.key?('environment') ? hash['environment'] : nil key_version = hash.key?('key_version') ? hash['key_version'] : nil # Create object from extracted values. SignatureNoV1Dto.new(cash_register_id, digital_signature, environment, key_version) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 |
# File 'lib/new_store_api/models/signature_no_v1_dto.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['cash_register_id'] = 'cash_register_id' @_hash['digital_signature'] = 'digital_signature' @_hash['environment'] = 'environment' @_hash['key_version'] = 'key_version' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/new_store_api/models/signature_no_v1_dto.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 |
# File 'lib/new_store_api/models/signature_no_v1_dto.rb', line 45 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
83 84 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 |
# File 'lib/new_store_api/models/signature_no_v1_dto.rb', line 83 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.cash_register_id, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.digital_signature, ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value.environment, ->(val) { FiscalEnvironmentEnum.validate(val) }) and APIHelper.valid_type?(value.key_version, ->(val) { val.instance_of? String }) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['cash_register_id'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['digital_signature'], ->(val) { val.instance_of? String }) and APIHelper.valid_type?(value['environment'], ->(val) { FiscalEnvironmentEnum.validate(val) }) and APIHelper.valid_type?(value['key_version'], ->(val) { val.instance_of? String }) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
119 120 121 122 123 124 |
# File 'lib/new_store_api/models/signature_no_v1_dto.rb', line 119 def inspect class_name = self.class.name.split('::').last "<#{class_name} cash_register_id: #{@cash_register_id.inspect}, digital_signature:"\ " #{@digital_signature.inspect}, environment: #{@environment.inspect}, key_version:"\ " #{@key_version.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
112 113 114 115 116 |
# File 'lib/new_store_api/models/signature_no_v1_dto.rb', line 112 def to_s class_name = self.class.name.split('::').last "<#{class_name} cash_register_id: #{@cash_register_id}, digital_signature:"\ " #{@digital_signature}, environment: #{@environment}, key_version: #{@key_version}>" end |