Class: NewStoreApi::CashboxCreatedV1Dto

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

Overview

CashboxCreatedV1Dto 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(activated_at = nil, config = nil, fiscal_provider_id = nil, id = nil, state = nil, store_id = nil, tenant = nil, deactivated_at = SKIP, warning_codes = SKIP) ⇒ CashboxCreatedV1Dto

Returns a new instance of CashboxCreatedV1Dto.



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 78

def initialize(activated_at = nil, config = nil, fiscal_provider_id = nil,
               id = nil, state = nil, store_id = nil, tenant = nil,
               deactivated_at = SKIP, warning_codes = SKIP)
  @activated_at = activated_at
  @config = config
  @deactivated_at = deactivated_at unless deactivated_at == SKIP
  @fiscal_provider_id = fiscal_provider_id
  @id = id
  @state = state
  @store_id = store_id
  @tenant = tenant
  @warning_codes = warning_codes unless warning_codes == SKIP
end

Instance Attribute Details

#activated_atDateTime

Timestamp of the cashbox activation.

Returns:

  • (DateTime)


15
16
17
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 15

def activated_at
  @activated_at
end

#configObject

Fiscal provider configuration.

Returns:

  • (Object)


19
20
21
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 19

def config
  @config
end

#deactivated_atDateTime

Timestamp of the cashbox deactivation.

Returns:

  • (DateTime)


23
24
25
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 23

def deactivated_at
  @deactivated_at
end

#fiscal_provider_idFiscalProviderIdEnum

Timestamp of the cashbox deactivation.



27
28
29
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 27

def fiscal_provider_id
  @fiscal_provider_id
end

#idString

Cashbox identifier.

Returns:

  • (String)


31
32
33
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 31

def id
  @id
end

#stateCashboxStateEnum

Cashbox identifier.

Returns:



35
36
37
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 35

def state
  @state
end

#store_idString

Store identifier that the cashbox belongs to.

Returns:

  • (String)


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

def store_id
  @store_id
end

#tenantString

Tenant identifier.

Returns:

  • (String)


43
44
45
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 43

def tenant
  @tenant
end

#warning_codesArray[F11nWarningCodeEnum]

List of warning codes that were indicated by the fiscal provider during fiscal activation.

Returns:



48
49
50
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 48

def warning_codes
  @warning_codes
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 93

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  activated_at = if hash.key?('activated_at')
                   (DateTimeHelper.from_rfc3339(hash['activated_at']) if hash['activated_at'])
                 end
  config = hash.key?('config') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:CashboxCreatedV1DtoConfig), hash['config']
  ) : nil
  fiscal_provider_id =
    hash.key?('fiscal_provider_id') ? hash['fiscal_provider_id'] : nil
  id = hash.key?('id') ? hash['id'] : nil
  state = hash.key?('state') ? hash['state'] : nil
  store_id = hash.key?('store_id') ? hash['store_id'] : nil
  tenant = hash.key?('tenant') ? hash['tenant'] : nil
  deactivated_at = if hash.key?('deactivated_at')
                     (DateTimeHelper.from_rfc3339(hash['deactivated_at']) if hash['deactivated_at'])
                   else
                     SKIP
                   end
  warning_codes = hash.key?('warning_codes') ? hash['warning_codes'] : SKIP

  # Create object from extracted values.
  CashboxCreatedV1Dto.new(activated_at,
                          config,
                          fiscal_provider_id,
                          id,
                          state,
                          store_id,
                          tenant,
                          deactivated_at,
                          warning_codes)
end

.namesObject

A mapping from model property names to API property names.



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 51

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['activated_at'] = 'activated_at'
  @_hash['config'] = 'config'
  @_hash['deactivated_at'] = 'deactivated_at'
  @_hash['fiscal_provider_id'] = 'fiscal_provider_id'
  @_hash['id'] = 'id'
  @_hash['state'] = 'state'
  @_hash['store_id'] = 'store_id'
  @_hash['tenant'] = 'tenant'
  @_hash['warning_codes'] = 'warning_codes'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 74

def self.nullables
  []
end

.optionalsObject

An array for optional fields



66
67
68
69
70
71
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 66

def self.optionals
  %w[
    deactivated_at
    warning_codes
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



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
176
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 138

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.activated_at,
                            ->(val) { val.instance_of? DateTime }) and
        UnionTypeLookUp.get(:CashboxCreatedV1DtoConfig)
                       .validate(value.config) and
        APIHelper.valid_type?(value.fiscal_provider_id,
                              ->(val) { FiscalProviderIdEnum.validate(val) }) and
        APIHelper.valid_type?(value.id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.state,
                              ->(val) { CashboxStateEnum.validate(val) }) and
        APIHelper.valid_type?(value.store_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.tenant,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['activated_at'],
                          ->(val) { val.instance_of? String }) and
      UnionTypeLookUp.get(:CashboxCreatedV1DtoConfig)
                     .validate(value['config']) and
      APIHelper.valid_type?(value['fiscal_provider_id'],
                            ->(val) { FiscalProviderIdEnum.validate(val) }) and
      APIHelper.valid_type?(value['id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['state'],
                            ->(val) { CashboxStateEnum.validate(val) }) and
      APIHelper.valid_type?(value['store_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['tenant'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



187
188
189
190
191
192
193
194
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 187

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} activated_at: #{@activated_at.inspect}, config: #{@config.inspect},"\
  " deactivated_at: #{@deactivated_at.inspect}, fiscal_provider_id:"\
  " #{@fiscal_provider_id.inspect}, id: #{@id.inspect}, state: #{@state.inspect}, store_id:"\
  " #{@store_id.inspect}, tenant: #{@tenant.inspect}, warning_codes:"\
  " #{@warning_codes.inspect}>"
end

#to_custom_activated_atObject



128
129
130
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 128

def to_custom_activated_at
  DateTimeHelper.to_rfc3339(activated_at)
end

#to_custom_deactivated_atObject



132
133
134
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 132

def to_custom_deactivated_at
  DateTimeHelper.to_rfc3339(deactivated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



179
180
181
182
183
184
# File 'lib/new_store_api/models/cashbox_created_v1_dto.rb', line 179

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} activated_at: #{@activated_at}, config: #{@config}, deactivated_at:"\
  " #{@deactivated_at}, fiscal_provider_id: #{@fiscal_provider_id}, id: #{@id}, state:"\
  " #{@state}, store_id: #{@store_id}, tenant: #{@tenant}, warning_codes: #{@warning_codes}>"
end