Class: NewStoreApi::SignatureSeV1Dto

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/signature_se_v1_dto.rb

Overview

SignatureSeV1Dto Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_name = nil, control_unit_response = nil, control_unit_serial = nil, environment = nil) ⇒ SignatureSeV1Dto

Returns a new instance of SignatureSeV1Dto.



48
49
50
51
52
53
54
# File 'lib/new_store_api/models/signature_se_v1_dto.rb', line 48

def initialize(cash_register_name = nil, control_unit_response = nil,
               control_unit_serial = nil, environment = nil)
  @cash_register_name = cash_register_name
  @control_unit_response = control_unit_response
  @control_unit_serial = control_unit_serial
  @environment = environment
end

Instance Attribute Details

#cash_register_nameString

Cash register name used with Axena.

Returns:

  • (String)


14
15
16
# File 'lib/new_store_api/models/signature_se_v1_dto.rb', line 14

def cash_register_name
  @cash_register_name
end

#control_unit_responseString

Control unit response.

Returns:

  • (String)


18
19
20
# File 'lib/new_store_api/models/signature_se_v1_dto.rb', line 18

def control_unit_response
  @control_unit_response
end

#control_unit_serialString

Control unit serial

Returns:

  • (String)


22
23
24
# File 'lib/new_store_api/models/signature_se_v1_dto.rb', line 22

def control_unit_serial
  @control_unit_serial
end

#environmentFiscalEnvironmentEnum

Control unit serial



26
27
28
# File 'lib/new_store_api/models/signature_se_v1_dto.rb', line 26

def environment
  @environment
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/new_store_api/models/signature_se_v1_dto.rb', line 57

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  cash_register_name =
    hash.key?('cash_register_name') ? hash['cash_register_name'] : nil
  control_unit_response =
    hash.key?('control_unit_response') ? hash['control_unit_response'] : nil
  control_unit_serial =
    hash.key?('control_unit_serial') ? hash['control_unit_serial'] : nil
  environment = hash.key?('environment') ? hash['environment'] : nil

  # Create object from extracted values.
  SignatureSeV1Dto.new(cash_register_name,
                       control_unit_response,
                       control_unit_serial,
                       environment)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/new_store_api/models/signature_se_v1_dto.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['cash_register_name'] = 'cash_register_name'
  @_hash['control_unit_response'] = 'control_unit_response'
  @_hash['control_unit_serial'] = 'control_unit_serial'
  @_hash['environment'] = 'environment'
  @_hash
end

.nullablesObject

An array for nullable fields



44
45
46
# File 'lib/new_store_api/models/signature_se_v1_dto.rb', line 44

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
# File 'lib/new_store_api/models/signature_se_v1_dto.rb', line 39

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/new_store_api/models/signature_se_v1_dto.rb', line 78

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.cash_register_name,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.control_unit_response,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.control_unit_serial,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.environment,
                              ->(val) { FiscalEnvironmentEnum.validate(val) })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['cash_register_name'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['control_unit_response'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['control_unit_serial'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['environment'],
                            ->(val) { FiscalEnvironmentEnum.validate(val) })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



115
116
117
118
119
120
# File 'lib/new_store_api/models/signature_se_v1_dto.rb', line 115

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} cash_register_name: #{@cash_register_name.inspect}, control_unit_response:"\
  " #{@control_unit_response.inspect}, control_unit_serial: #{@control_unit_serial.inspect},"\
  " environment: #{@environment.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



107
108
109
110
111
112
# File 'lib/new_store_api/models/signature_se_v1_dto.rb', line 107

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} cash_register_name: #{@cash_register_name}, control_unit_response:"\
  " #{@control_unit_response}, control_unit_serial: #{@control_unit_serial}, environment:"\
  " #{@environment}>"
end