Class: NewStoreApi::SignatureFrV1Dto

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

Overview

SignatureFrV1Dto 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(ape_identifier = nil, cashbox_id = nil, cashbox_name = nil, environment = nil, portal_receipt_url = nil, queue_id = nil, queue_item_id = nil, queue_row = nil, receipt_id = nil, receipt_moment = nil, signature_items = nil, state = nil, state_data = nil, terminal_id = nil, vat_number = nil, operation = SKIP) ⇒ SignatureFrV1Dto

Returns a new instance of SignatureFrV1Dto.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 111

def initialize(ape_identifier = nil, cashbox_id = nil, cashbox_name = nil,
               environment = nil, portal_receipt_url = nil, queue_id = nil,
               queue_item_id = nil, queue_row = nil, receipt_id = nil,
               receipt_moment = nil, signature_items = nil, state = nil,
               state_data = nil, terminal_id = nil, vat_number = nil,
               operation = SKIP)
  @ape_identifier = ape_identifier
  @cashbox_id = cashbox_id
  @cashbox_name = cashbox_name
  @environment = environment
  @operation = operation unless operation == SKIP
  @portal_receipt_url = portal_receipt_url
  @queue_id = queue_id
  @queue_item_id = queue_item_id
  @queue_row = queue_row
  @receipt_id = receipt_id
  @receipt_moment = receipt_moment
  @signature_items = signature_items
  @state = state
  @state_data = state_data
  @terminal_id = terminal_id
  @vat_number = vat_number
end

Instance Attribute Details

#ape_identifierString

The APE code of the tenant.

Returns:

  • (String)


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

def ape_identifier
  @ape_identifier
end

#cashbox_idString

Cashbox ID.

Returns:

  • (String)


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

def cashbox_id
  @cashbox_id
end

#cashbox_nameString

Cashbox name.

Returns:

  • (String)


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

def cashbox_name
  @cashbox_name
end

#environmentFiscalEnvironmentEnum

Cashbox name.



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

def environment
  @environment
end

#operationString

The type of operation.

Returns:

  • (String)


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

def operation
  @operation
end

#portal_receipt_urlString

Receipt URL in fiskaltrust Portal.

Returns:

  • (String)


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

def portal_receipt_url
  @portal_receipt_url
end

#queue_idString

Queue ID.

Returns:

  • (String)


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

def queue_id
  @queue_id
end

#queue_item_idString

Queue item ID.

Returns:

  • (String)


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

def queue_item_id
  @queue_item_id
end

#queue_rowInteger

Queue row.

Returns:

  • (Integer)


47
48
49
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 47

def queue_row
  @queue_row
end

#receipt_idString

Receipt ID to be printed on receipt.

Returns:

  • (String)


51
52
53
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 51

def receipt_id
  @receipt_id
end

#receipt_momentDateTime

Receipt moment.

Returns:

  • (DateTime)


55
56
57
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 55

def receipt_moment
  @receipt_moment
end

#signature_itemsArray[SignatureItemFrV1Dto]

List of signature items to be printed on receipt.

Returns:



59
60
61
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 59

def signature_items
  @signature_items
end

#stateFtFrStateEnum

List of signature items to be printed on receipt.

Returns:



63
64
65
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 63

def state
  @state
end

#state_dataObject

Additional state data (JSON string).

Returns:

  • (Object)


67
68
69
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 67

def state_data
  @state_data
end

#terminal_idString

Terminal/associate ID.

Returns:

  • (String)


71
72
73
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 71

def terminal_id
  @terminal_id
end

#vat_numberString

The VAT identification number of the tenant.

Returns:

  • (String)


75
76
77
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 75

def vat_number
  @vat_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



136
137
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
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 136

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  ape_identifier =
    hash.key?('ape_identifier') ? hash['ape_identifier'] : nil
  cashbox_id = hash.key?('cashbox_id') ? hash['cashbox_id'] : nil
  cashbox_name = hash.key?('cashbox_name') ? hash['cashbox_name'] : nil
  environment = hash.key?('environment') ? hash['environment'] : nil
  portal_receipt_url =
    hash.key?('portal_receipt_url') ? hash['portal_receipt_url'] : nil
  queue_id = hash.key?('queue_id') ? hash['queue_id'] : nil
  queue_item_id = hash.key?('queue_item_id') ? hash['queue_item_id'] : nil
  queue_row = hash.key?('queue_row') ? hash['queue_row'] : nil
  receipt_id = hash.key?('receipt_id') ? hash['receipt_id'] : nil
  receipt_moment = if hash.key?('receipt_moment')
                     (DateTimeHelper.from_rfc3339(hash['receipt_moment']) if hash['receipt_moment'])
                   end
  # Parameter is an array, so we need to iterate through it
  signature_items = nil
  unless hash['signature_items'].nil?
    signature_items = []
    hash['signature_items'].each do |structure|
      signature_items << (SignatureItemFrV1Dto.from_hash(structure) if structure)
    end
  end

  signature_items = nil unless hash.key?('signature_items')
  state = hash.key?('state') ? hash['state'] : nil
  state_data = hash.key?('state_data') ? hash['state_data'] : nil
  terminal_id = hash.key?('terminal_id') ? hash['terminal_id'] : nil
  vat_number = hash.key?('vat_number') ? hash['vat_number'] : nil
  operation = hash.key?('operation') ? hash['operation'] : SKIP

  # Create object from extracted values.
  SignatureFrV1Dto.new(ape_identifier,
                       cashbox_id,
                       cashbox_name,
                       environment,
                       portal_receipt_url,
                       queue_id,
                       queue_item_id,
                       queue_row,
                       receipt_id,
                       receipt_moment,
                       signature_items,
                       state,
                       state_data,
                       terminal_id,
                       vat_number,
                       operation)
end

.namesObject

A mapping from model property names to API property names.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 78

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['ape_identifier'] = 'ape_identifier'
  @_hash['cashbox_id'] = 'cashbox_id'
  @_hash['cashbox_name'] = 'cashbox_name'
  @_hash['environment'] = 'environment'
  @_hash['operation'] = 'operation'
  @_hash['portal_receipt_url'] = 'portal_receipt_url'
  @_hash['queue_id'] = 'queue_id'
  @_hash['queue_item_id'] = 'queue_item_id'
  @_hash['queue_row'] = 'queue_row'
  @_hash['receipt_id'] = 'receipt_id'
  @_hash['receipt_moment'] = 'receipt_moment'
  @_hash['signature_items'] = 'signature_items'
  @_hash['state'] = 'state'
  @_hash['state_data'] = 'state_data'
  @_hash['terminal_id'] = 'terminal_id'
  @_hash['vat_number'] = 'vat_number'
  @_hash
end

.nullablesObject

An array for nullable fields



107
108
109
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 107

def self.nullables
  []
end

.optionalsObject

An array for optional fields



100
101
102
103
104
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 100

def self.optionals
  %w[
    operation
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 195

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.ape_identifier,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.cashbox_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.cashbox_name,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.environment,
                              ->(val) { FiscalEnvironmentEnum.validate(val) }) and
        APIHelper.valid_type?(value.portal_receipt_url,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.queue_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.queue_item_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.queue_row,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.receipt_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.receipt_moment,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.signature_items,
                              ->(val) { SignatureItemFrV1Dto.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true) and
        APIHelper.valid_type?(value.state,
                              ->(val) { FtFrStateEnum.validate(val) }) and
        APIHelper.valid_type?(value.state_data,
                              ->(val) { val.instance_of? Object }) and
        APIHelper.valid_type?(value.terminal_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.vat_number,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['ape_identifier'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['cashbox_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['cashbox_name'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['environment'],
                            ->(val) { FiscalEnvironmentEnum.validate(val) }) and
      APIHelper.valid_type?(value['portal_receipt_url'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['queue_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['queue_item_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['queue_row'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['receipt_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['receipt_moment'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['signature_items'],
                            ->(val) { SignatureItemFrV1Dto.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
      APIHelper.valid_type?(value['state'],
                            ->(val) { FtFrStateEnum.validate(val) }) and
      APIHelper.valid_type?(value['state_data'],
                            ->(val) { val.instance_of? Object }) and
      APIHelper.valid_type?(value['terminal_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['vat_number'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



283
284
285
286
287
288
289
290
291
292
293
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 283

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} ape_identifier: #{@ape_identifier.inspect}, cashbox_id:"\
  " #{@cashbox_id.inspect}, cashbox_name: #{@cashbox_name.inspect}, environment:"\
  " #{@environment.inspect}, operation: #{@operation.inspect}, portal_receipt_url:"\
  " #{@portal_receipt_url.inspect}, queue_id: #{@queue_id.inspect}, queue_item_id:"\
  " #{@queue_item_id.inspect}, queue_row: #{@queue_row.inspect}, receipt_id:"\
  " #{@receipt_id.inspect}, receipt_moment: #{@receipt_moment.inspect}, signature_items:"\
  " #{@signature_items.inspect}, state: #{@state.inspect}, state_data: #{@state_data.inspect},"\
  " terminal_id: #{@terminal_id.inspect}, vat_number: #{@vat_number.inspect}>"
end

#to_custom_receipt_momentObject



189
190
191
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 189

def to_custom_receipt_moment
  DateTimeHelper.to_rfc3339(receipt_moment)
end

#to_sObject

Provides a human-readable string representation of the object.



272
273
274
275
276
277
278
279
280
# File 'lib/new_store_api/models/signature_fr_v1_dto.rb', line 272

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} ape_identifier: #{@ape_identifier}, cashbox_id: #{@cashbox_id},"\
  " cashbox_name: #{@cashbox_name}, environment: #{@environment}, operation: #{@operation},"\
  " portal_receipt_url: #{@portal_receipt_url}, queue_id: #{@queue_id}, queue_item_id:"\
  " #{@queue_item_id}, queue_row: #{@queue_row}, receipt_id: #{@receipt_id}, receipt_moment:"\
  " #{@receipt_moment}, signature_items: #{@signature_items}, state: #{@state}, state_data:"\
  " #{@state_data}, terminal_id: #{@terminal_id}, vat_number: #{@vat_number}>"
end