Class: NewStoreApi::CashboxGetV1Dto

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

Overview

CashboxGetV1Dto 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, transaction_series = nil, deactivated_at = SKIP) ⇒ CashboxGetV1Dto

Returns a new instance of CashboxGetV1Dto.



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/new_store_api/models/cashbox_get_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,
               transaction_series = nil, deactivated_at = 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
  @transaction_series = transaction_series
end

Instance Attribute Details

#activated_atDateTime

Timestamp of the cashbox activation.

Returns:

  • (DateTime)


15
16
17
# File 'lib/new_store_api/models/cashbox_get_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_get_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_get_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_get_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_get_v1_dto.rb', line 31

def id
  @id
end

#stateCashboxStateEnum

Cashbox identifier.

Returns:



35
36
37
# File 'lib/new_store_api/models/cashbox_get_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_get_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_get_v1_dto.rb', line 43

def tenant
  @tenant
end

#transaction_seriesArray[String]

The series used to generate the transaction sequence numbers. This field will have a value only for cashboxes that support multiple series otherwise it will be an empty array.

Returns:

  • (Array[String])


49
50
51
# File 'lib/new_store_api/models/cashbox_get_v1_dto.rb', line 49

def transaction_series
  @transaction_series
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
127
# File 'lib/new_store_api/models/cashbox_get_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(:CashboxGetV1DtoConfig), 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
  transaction_series =
    hash.key?('transaction_series') ? hash['transaction_series'] : nil
  deactivated_at = if hash.key?('deactivated_at')
                     (DateTimeHelper.from_rfc3339(hash['deactivated_at']) if hash['deactivated_at'])
                   else
                     SKIP
                   end

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

.namesObject

A mapping from model property names to API property names.



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

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['transaction_series'] = 'transaction_series'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    deactivated_at
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (CashboxGetV1Dto | Hash)

    value against the validation is performed.



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
177
178
179
180
181
# File 'lib/new_store_api/models/cashbox_get_v1_dto.rb', line 139

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.activated_at,
                            ->(val) { val.instance_of? DateTime }) and
        UnionTypeLookUp.get(:CashboxGetV1DtoConfig)
                       .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 }) and
        APIHelper.valid_type?(value.transaction_series,
                              ->(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(:CashboxGetV1DtoConfig)
                     .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 }) and
      APIHelper.valid_type?(value['transaction_series'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



193
194
195
196
197
198
199
200
# File 'lib/new_store_api/models/cashbox_get_v1_dto.rb', line 193

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}, transaction_series:"\
  " #{@transaction_series.inspect}>"
end

#to_custom_activated_atObject



129
130
131
# File 'lib/new_store_api/models/cashbox_get_v1_dto.rb', line 129

def to_custom_activated_at
  DateTimeHelper.to_rfc3339(activated_at)
end

#to_custom_deactivated_atObject



133
134
135
# File 'lib/new_store_api/models/cashbox_get_v1_dto.rb', line 133

def to_custom_deactivated_at
  DateTimeHelper.to_rfc3339(deactivated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



184
185
186
187
188
189
190
# File 'lib/new_store_api/models/cashbox_get_v1_dto.rb', line 184

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}, transaction_series:"\
  " #{@transaction_series}>"
end