tachain-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/LICENSE +21 -0
  4. data/README.md +226 -0
  5. data/Rakefile +10 -0
  6. data/git_push.sh +54 -0
  7. data/lib/tachain-sdk/api/api_declaration_api.rb +396 -0
  8. data/lib/tachain-sdk/api/api_delivery_api.rb +676 -0
  9. data/lib/tachain-sdk/api/api_enum_api.rb +94 -0
  10. data/lib/tachain-sdk/api/api_order_api.rb +846 -0
  11. data/lib/tachain-sdk/api/api_order_workflow_api.rb +170 -0
  12. data/lib/tachain-sdk/api/api_production_api.rb +466 -0
  13. data/lib/tachain-sdk/api_client.rb +397 -0
  14. data/lib/tachain-sdk/api_error.rb +58 -0
  15. data/lib/tachain-sdk/api_model_base.rb +88 -0
  16. data/lib/tachain-sdk/configuration.rb +329 -0
  17. data/lib/tachain-sdk/models/api_declaration_delete_request.rb +341 -0
  18. data/lib/tachain-sdk/models/api_declaration_document_request.rb +209 -0
  19. data/lib/tachain-sdk/models/api_declaration_list_dto.rb +251 -0
  20. data/lib/tachain-sdk/models/api_declaration_submit_request.rb +251 -0
  21. data/lib/tachain-sdk/models/api_declaration_submit_result_dto.rb +197 -0
  22. data/lib/tachain-sdk/models/api_integration_delete_request.rb +209 -0
  23. data/lib/tachain-sdk/models/api_order_confirm_receipt_request.rb +216 -0
  24. data/lib/tachain-sdk/models/api_order_submit_audit_request.rb +243 -0
  25. data/lib/tachain-sdk/models/api_response_api_declaration_list_dto.rb +199 -0
  26. data/lib/tachain-sdk/models/api_response_api_declaration_submit_result_dto.rb +199 -0
  27. data/lib/tachain-sdk/models/api_response_delivery_note_api_dto.rb +199 -0
  28. data/lib/tachain-sdk/models/api_response_order_api_dto.rb +199 -0
  29. data/lib/tachain-sdk/models/api_response_production_api_dto.rb +199 -0
  30. data/lib/tachain-sdk/models/api_response_string.rb +200 -0
  31. data/lib/tachain-sdk/models/attachment_in_api_create_dto.rb +262 -0
  32. data/lib/tachain-sdk/models/attachment_in_api_dto.rb +363 -0
  33. data/lib/tachain-sdk/models/brand_kpi_policy_result.rb +334 -0
  34. data/lib/tachain-sdk/models/brand_order_kpi_snapshot_dto.rb +880 -0
  35. data/lib/tachain-sdk/models/brand_order_supplier_order_snapshot_dto.rb +749 -0
  36. data/lib/tachain-sdk/models/brand_order_uncompleted_declare_snapshot_dto.rb +513 -0
  37. data/lib/tachain-sdk/models/company.rb +780 -0
  38. data/lib/tachain-sdk/models/company_compliance_profile.rb +547 -0
  39. data/lib/tachain-sdk/models/company_utility_declaration.rb +592 -0
  40. data/lib/tachain-sdk/models/customer.rb +569 -0
  41. data/lib/tachain-sdk/models/delivery_note_api_dto.rb +597 -0
  42. data/lib/tachain-sdk/models/delivery_note_detail_api_dto.rb +682 -0
  43. data/lib/tachain-sdk/models/document_type_api_dto.rb +480 -0
  44. data/lib/tachain-sdk/models/factory.rb +545 -0
  45. data/lib/tachain-sdk/models/get_v1_enum_get_list200_response.rb +201 -0
  46. data/lib/tachain-sdk/models/microsoft_asp_net_core_mvc_problem_details.rb +188 -0
  47. data/lib/tachain-sdk/models/model1.rb +157 -0
  48. data/lib/tachain-sdk/models/model3.rb +202 -0
  49. data/lib/tachain-sdk/models/model4.rb +202 -0
  50. data/lib/tachain-sdk/models/order.rb +974 -0
  51. data/lib/tachain-sdk/models/order_api_dto.rb +918 -0
  52. data/lib/tachain-sdk/models/order_line.rb +1184 -0
  53. data/lib/tachain-sdk/models/order_line_api_dto.rb +1277 -0
  54. data/lib/tachain-sdk/models/order_stage_form_api_dto.rb +270 -0
  55. data/lib/tachain-sdk/models/order_stage_form_datum_api_dto.rb +260 -0
  56. data/lib/tachain-sdk/models/order_stage_form_dto.rb +254 -0
  57. data/lib/tachain-sdk/models/paged_response_delivery_note_api_dto.rb +296 -0
  58. data/lib/tachain-sdk/models/paged_response_order_api_dto.rb +296 -0
  59. data/lib/tachain-sdk/models/paged_response_production_api_dto.rb +296 -0
  60. data/lib/tachain-sdk/models/product_bom_grouping_dto.rb +280 -0
  61. data/lib/tachain-sdk/models/production_api_dto.rb +639 -0
  62. data/lib/tachain-sdk/models/production_raw_material_api_dto.rb +481 -0
  63. data/lib/tachain-sdk/models/production_raw_material_dto.rb +548 -0
  64. data/lib/tachain-sdk/models/production_sales_order_api_dto.rb +436 -0
  65. data/lib/tachain-sdk/models/result_api_enum.rb +270 -0
  66. data/lib/tachain-sdk/models/result_brand_report_allocated_delivery_kpi_detail.rb +331 -0
  67. data/lib/tachain-sdk/models/result_brand_report_unlinked_order_detail.rb +229 -0
  68. data/lib/tachain-sdk/models/result_kpi_archived_data_change_detail.rb +418 -0
  69. data/lib/tachain-sdk/models/result_mapping_order_select.rb +335 -0
  70. data/lib/tachain-sdk/models/result_order_trace_report.rb +721 -0
  71. data/lib/tachain-sdk/models/stage_attachment_api_dto.rb +398 -0
  72. data/lib/tachain-sdk/models/supplier.rb +585 -0
  73. data/lib/tachain-sdk/models/supplier_onboarding_ext.rb +383 -0
  74. data/lib/tachain-sdk/models/template_dto_business_risk_warn_info_dto.rb +456 -0
  75. data/lib/tachain-sdk/models/template_dto_multi_so_line_complete_status.rb +227 -0
  76. data/lib/tachain-sdk/models/trader.rb +506 -0
  77. data/lib/tachain-sdk/signed_api_client.rb +65 -0
  78. data/lib/tachain-sdk/version.rb +15 -0
  79. data/lib/tachain-sdk.rb +108 -0
  80. data/spec/spec_helper.rb +111 -0
  81. data/tachain-sdk.gemspec +39 -0
  82. metadata +165 -0
@@ -0,0 +1,592 @@
1
+ =begin
2
+ #Tactic Chain Public API
3
+
4
+ #Public integration endpoints. Set your own base URL and credential before calling.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.25.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TachainSdk
17
+ # Annual or monthly electricity/water declarations for PEFCR organization and facility scopes.
18
+ class CompanyUtilityDeclaration < ApiModelBase
19
+ attr_accessor :id
20
+
21
+ attr_accessor :tenant_id
22
+
23
+ attr_accessor :company_id
24
+
25
+ attr_accessor :scope_type
26
+
27
+ attr_accessor :scope_id
28
+
29
+ attr_accessor :facility_id
30
+
31
+ attr_accessor :granularity
32
+
33
+ attr_accessor :reporting_year
34
+
35
+ attr_accessor :reporting_month
36
+
37
+ attr_accessor :period_start
38
+
39
+ attr_accessor :period_end
40
+
41
+ attr_accessor :electricity_kwh
42
+
43
+ attr_accessor :water_m3
44
+
45
+ attr_accessor :notes
46
+
47
+ attr_accessor :evidence_url
48
+
49
+ attr_accessor :row_version
50
+
51
+ attr_accessor :created_by
52
+
53
+ attr_accessor :created_at
54
+
55
+ attr_accessor :updated_by
56
+
57
+ attr_accessor :updated_at
58
+
59
+ attr_accessor :status
60
+
61
+ attr_accessor :company
62
+
63
+ attr_accessor :facility
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'id' => :'id',
69
+ :'tenant_id' => :'tenantId',
70
+ :'company_id' => :'companyId',
71
+ :'scope_type' => :'scopeType',
72
+ :'scope_id' => :'scopeId',
73
+ :'facility_id' => :'facilityId',
74
+ :'granularity' => :'granularity',
75
+ :'reporting_year' => :'reportingYear',
76
+ :'reporting_month' => :'reportingMonth',
77
+ :'period_start' => :'periodStart',
78
+ :'period_end' => :'periodEnd',
79
+ :'electricity_kwh' => :'electricityKwh',
80
+ :'water_m3' => :'waterM3',
81
+ :'notes' => :'notes',
82
+ :'evidence_url' => :'evidenceUrl',
83
+ :'row_version' => :'rowVersion',
84
+ :'created_by' => :'createdBy',
85
+ :'created_at' => :'createdAt',
86
+ :'updated_by' => :'updatedBy',
87
+ :'updated_at' => :'updatedAt',
88
+ :'status' => :'status',
89
+ :'company' => :'company',
90
+ :'facility' => :'facility'
91
+ }
92
+ end
93
+
94
+ # Returns attribute mapping this model knows about
95
+ def self.acceptable_attribute_map
96
+ attribute_map
97
+ end
98
+
99
+ # Returns all the JSON keys this model knows about
100
+ def self.acceptable_attributes
101
+ acceptable_attribute_map.values
102
+ end
103
+
104
+ # Attribute type mapping.
105
+ def self.openapi_types
106
+ {
107
+ :'id' => :'String',
108
+ :'tenant_id' => :'String',
109
+ :'company_id' => :'String',
110
+ :'scope_type' => :'String',
111
+ :'scope_id' => :'String',
112
+ :'facility_id' => :'String',
113
+ :'granularity' => :'String',
114
+ :'reporting_year' => :'Integer',
115
+ :'reporting_month' => :'Integer',
116
+ :'period_start' => :'Date',
117
+ :'period_end' => :'Date',
118
+ :'electricity_kwh' => :'Float',
119
+ :'water_m3' => :'Float',
120
+ :'notes' => :'String',
121
+ :'evidence_url' => :'String',
122
+ :'row_version' => :'Integer',
123
+ :'created_by' => :'String',
124
+ :'created_at' => :'Time',
125
+ :'updated_by' => :'String',
126
+ :'updated_at' => :'Time',
127
+ :'status' => :'Integer',
128
+ :'company' => :'Company',
129
+ :'facility' => :'Factory'
130
+ }
131
+ end
132
+
133
+ # List of attributes with nullable: true
134
+ def self.openapi_nullable
135
+ Set.new([
136
+ :'facility_id',
137
+ :'reporting_month',
138
+ :'electricity_kwh',
139
+ :'water_m3',
140
+ :'notes',
141
+ :'evidence_url',
142
+ :'updated_by',
143
+ :'updated_at',
144
+ ])
145
+ end
146
+
147
+ # Initializes the object
148
+ # @param [Hash] attributes Model attributes in the form of hash
149
+ def initialize(attributes = {})
150
+ if (!attributes.is_a?(Hash))
151
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TachainSdk::CompanyUtilityDeclaration` initialize method"
152
+ end
153
+
154
+ # check to see if the attribute exists and convert string to symbol for hash key
155
+ acceptable_attribute_map = self.class.acceptable_attribute_map
156
+ attributes = attributes.each_with_object({}) { |(k, v), h|
157
+ if (!acceptable_attribute_map.key?(k.to_sym))
158
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TachainSdk::CompanyUtilityDeclaration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
159
+ end
160
+ h[k.to_sym] = v
161
+ }
162
+
163
+ if attributes.key?(:'id')
164
+ self.id = attributes[:'id']
165
+ else
166
+ self.id = nil
167
+ end
168
+
169
+ if attributes.key?(:'tenant_id')
170
+ self.tenant_id = attributes[:'tenant_id']
171
+ else
172
+ self.tenant_id = nil
173
+ end
174
+
175
+ if attributes.key?(:'company_id')
176
+ self.company_id = attributes[:'company_id']
177
+ else
178
+ self.company_id = nil
179
+ end
180
+
181
+ if attributes.key?(:'scope_type')
182
+ self.scope_type = attributes[:'scope_type']
183
+ else
184
+ self.scope_type = nil
185
+ end
186
+
187
+ if attributes.key?(:'scope_id')
188
+ self.scope_id = attributes[:'scope_id']
189
+ else
190
+ self.scope_id = nil
191
+ end
192
+
193
+ if attributes.key?(:'facility_id')
194
+ self.facility_id = attributes[:'facility_id']
195
+ end
196
+
197
+ if attributes.key?(:'granularity')
198
+ self.granularity = attributes[:'granularity']
199
+ else
200
+ self.granularity = nil
201
+ end
202
+
203
+ if attributes.key?(:'reporting_year')
204
+ self.reporting_year = attributes[:'reporting_year']
205
+ else
206
+ self.reporting_year = nil
207
+ end
208
+
209
+ if attributes.key?(:'reporting_month')
210
+ self.reporting_month = attributes[:'reporting_month']
211
+ end
212
+
213
+ if attributes.key?(:'period_start')
214
+ self.period_start = attributes[:'period_start']
215
+ else
216
+ self.period_start = nil
217
+ end
218
+
219
+ if attributes.key?(:'period_end')
220
+ self.period_end = attributes[:'period_end']
221
+ else
222
+ self.period_end = nil
223
+ end
224
+
225
+ if attributes.key?(:'electricity_kwh')
226
+ self.electricity_kwh = attributes[:'electricity_kwh']
227
+ end
228
+
229
+ if attributes.key?(:'water_m3')
230
+ self.water_m3 = attributes[:'water_m3']
231
+ end
232
+
233
+ if attributes.key?(:'notes')
234
+ self.notes = attributes[:'notes']
235
+ end
236
+
237
+ if attributes.key?(:'evidence_url')
238
+ self.evidence_url = attributes[:'evidence_url']
239
+ end
240
+
241
+ if attributes.key?(:'row_version')
242
+ self.row_version = attributes[:'row_version']
243
+ else
244
+ self.row_version = nil
245
+ end
246
+
247
+ if attributes.key?(:'created_by')
248
+ self.created_by = attributes[:'created_by']
249
+ else
250
+ self.created_by = nil
251
+ end
252
+
253
+ if attributes.key?(:'created_at')
254
+ self.created_at = attributes[:'created_at']
255
+ else
256
+ self.created_at = nil
257
+ end
258
+
259
+ if attributes.key?(:'updated_by')
260
+ self.updated_by = attributes[:'updated_by']
261
+ end
262
+
263
+ if attributes.key?(:'updated_at')
264
+ self.updated_at = attributes[:'updated_at']
265
+ end
266
+
267
+ if attributes.key?(:'status')
268
+ self.status = attributes[:'status']
269
+ else
270
+ self.status = nil
271
+ end
272
+
273
+ if attributes.key?(:'company')
274
+ self.company = attributes[:'company']
275
+ else
276
+ self.company = nil
277
+ end
278
+
279
+ if attributes.key?(:'facility')
280
+ self.facility = attributes[:'facility']
281
+ end
282
+ end
283
+
284
+ # Show invalid properties with the reasons. Usually used together with valid?
285
+ # @return Array for valid properties with the reasons
286
+ def list_invalid_properties
287
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
288
+ invalid_properties = Array.new
289
+ if @id.nil?
290
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
291
+ end
292
+
293
+ if @tenant_id.nil?
294
+ invalid_properties.push('invalid value for "tenant_id", tenant_id cannot be nil.')
295
+ end
296
+
297
+ if @company_id.nil?
298
+ invalid_properties.push('invalid value for "company_id", company_id cannot be nil.')
299
+ end
300
+
301
+ if @scope_type.nil?
302
+ invalid_properties.push('invalid value for "scope_type", scope_type cannot be nil.')
303
+ end
304
+
305
+ if @scope_id.nil?
306
+ invalid_properties.push('invalid value for "scope_id", scope_id cannot be nil.')
307
+ end
308
+
309
+ if @granularity.nil?
310
+ invalid_properties.push('invalid value for "granularity", granularity cannot be nil.')
311
+ end
312
+
313
+ if @reporting_year.nil?
314
+ invalid_properties.push('invalid value for "reporting_year", reporting_year cannot be nil.')
315
+ end
316
+
317
+ if @period_start.nil?
318
+ invalid_properties.push('invalid value for "period_start", period_start cannot be nil.')
319
+ end
320
+
321
+ if @period_end.nil?
322
+ invalid_properties.push('invalid value for "period_end", period_end cannot be nil.')
323
+ end
324
+
325
+ if @row_version.nil?
326
+ invalid_properties.push('invalid value for "row_version", row_version cannot be nil.')
327
+ end
328
+
329
+ if @created_by.nil?
330
+ invalid_properties.push('invalid value for "created_by", created_by cannot be nil.')
331
+ end
332
+
333
+ if @created_at.nil?
334
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
335
+ end
336
+
337
+ if @status.nil?
338
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
339
+ end
340
+
341
+ if @company.nil?
342
+ invalid_properties.push('invalid value for "company", company cannot be nil.')
343
+ end
344
+
345
+ invalid_properties
346
+ end
347
+
348
+ # Check to see if the all the properties in the model are valid
349
+ # @return true if the model is valid
350
+ def valid?
351
+ warn '[DEPRECATED] the `valid?` method is obsolete'
352
+ return false if @id.nil?
353
+ return false if @tenant_id.nil?
354
+ return false if @company_id.nil?
355
+ return false if @scope_type.nil?
356
+ return false if @scope_id.nil?
357
+ return false if @granularity.nil?
358
+ return false if @reporting_year.nil?
359
+ return false if @period_start.nil?
360
+ return false if @period_end.nil?
361
+ return false if @row_version.nil?
362
+ return false if @created_by.nil?
363
+ return false if @created_at.nil?
364
+ return false if @status.nil?
365
+ return false if @company.nil?
366
+ true
367
+ end
368
+
369
+ # Custom attribute writer method with validation
370
+ # @param [Object] id Value to be assigned
371
+ def id=(id)
372
+ if id.nil?
373
+ fail ArgumentError, 'id cannot be nil'
374
+ end
375
+
376
+ @id = id
377
+ end
378
+
379
+ # Custom attribute writer method with validation
380
+ # @param [Object] tenant_id Value to be assigned
381
+ def tenant_id=(tenant_id)
382
+ if tenant_id.nil?
383
+ fail ArgumentError, 'tenant_id cannot be nil'
384
+ end
385
+
386
+ @tenant_id = tenant_id
387
+ end
388
+
389
+ # Custom attribute writer method with validation
390
+ # @param [Object] company_id Value to be assigned
391
+ def company_id=(company_id)
392
+ if company_id.nil?
393
+ fail ArgumentError, 'company_id cannot be nil'
394
+ end
395
+
396
+ @company_id = company_id
397
+ end
398
+
399
+ # Custom attribute writer method with validation
400
+ # @param [Object] scope_type Value to be assigned
401
+ def scope_type=(scope_type)
402
+ if scope_type.nil?
403
+ fail ArgumentError, 'scope_type cannot be nil'
404
+ end
405
+
406
+ @scope_type = scope_type
407
+ end
408
+
409
+ # Custom attribute writer method with validation
410
+ # @param [Object] scope_id Value to be assigned
411
+ def scope_id=(scope_id)
412
+ if scope_id.nil?
413
+ fail ArgumentError, 'scope_id cannot be nil'
414
+ end
415
+
416
+ @scope_id = scope_id
417
+ end
418
+
419
+ # Custom attribute writer method with validation
420
+ # @param [Object] granularity Value to be assigned
421
+ def granularity=(granularity)
422
+ if granularity.nil?
423
+ fail ArgumentError, 'granularity cannot be nil'
424
+ end
425
+
426
+ @granularity = granularity
427
+ end
428
+
429
+ # Custom attribute writer method with validation
430
+ # @param [Object] reporting_year Value to be assigned
431
+ def reporting_year=(reporting_year)
432
+ if reporting_year.nil?
433
+ fail ArgumentError, 'reporting_year cannot be nil'
434
+ end
435
+
436
+ @reporting_year = reporting_year
437
+ end
438
+
439
+ # Custom attribute writer method with validation
440
+ # @param [Object] period_start Value to be assigned
441
+ def period_start=(period_start)
442
+ if period_start.nil?
443
+ fail ArgumentError, 'period_start cannot be nil'
444
+ end
445
+
446
+ @period_start = period_start
447
+ end
448
+
449
+ # Custom attribute writer method with validation
450
+ # @param [Object] period_end Value to be assigned
451
+ def period_end=(period_end)
452
+ if period_end.nil?
453
+ fail ArgumentError, 'period_end cannot be nil'
454
+ end
455
+
456
+ @period_end = period_end
457
+ end
458
+
459
+ # Custom attribute writer method with validation
460
+ # @param [Object] row_version Value to be assigned
461
+ def row_version=(row_version)
462
+ if row_version.nil?
463
+ fail ArgumentError, 'row_version cannot be nil'
464
+ end
465
+
466
+ @row_version = row_version
467
+ end
468
+
469
+ # Custom attribute writer method with validation
470
+ # @param [Object] created_by Value to be assigned
471
+ def created_by=(created_by)
472
+ if created_by.nil?
473
+ fail ArgumentError, 'created_by cannot be nil'
474
+ end
475
+
476
+ @created_by = created_by
477
+ end
478
+
479
+ # Custom attribute writer method with validation
480
+ # @param [Object] created_at Value to be assigned
481
+ def created_at=(created_at)
482
+ if created_at.nil?
483
+ fail ArgumentError, 'created_at cannot be nil'
484
+ end
485
+
486
+ @created_at = created_at
487
+ end
488
+
489
+ # Custom attribute writer method with validation
490
+ # @param [Object] status Value to be assigned
491
+ def status=(status)
492
+ if status.nil?
493
+ fail ArgumentError, 'status cannot be nil'
494
+ end
495
+
496
+ @status = status
497
+ end
498
+
499
+ # Custom attribute writer method with validation
500
+ # @param [Object] company Value to be assigned
501
+ def company=(company)
502
+ if company.nil?
503
+ fail ArgumentError, 'company cannot be nil'
504
+ end
505
+
506
+ @company = company
507
+ end
508
+
509
+ # Checks equality by comparing each attribute.
510
+ # @param [Object] Object to be compared
511
+ def ==(o)
512
+ return true if self.equal?(o)
513
+ self.class == o.class &&
514
+ id == o.id &&
515
+ tenant_id == o.tenant_id &&
516
+ company_id == o.company_id &&
517
+ scope_type == o.scope_type &&
518
+ scope_id == o.scope_id &&
519
+ facility_id == o.facility_id &&
520
+ granularity == o.granularity &&
521
+ reporting_year == o.reporting_year &&
522
+ reporting_month == o.reporting_month &&
523
+ period_start == o.period_start &&
524
+ period_end == o.period_end &&
525
+ electricity_kwh == o.electricity_kwh &&
526
+ water_m3 == o.water_m3 &&
527
+ notes == o.notes &&
528
+ evidence_url == o.evidence_url &&
529
+ row_version == o.row_version &&
530
+ created_by == o.created_by &&
531
+ created_at == o.created_at &&
532
+ updated_by == o.updated_by &&
533
+ updated_at == o.updated_at &&
534
+ status == o.status &&
535
+ company == o.company &&
536
+ facility == o.facility
537
+ end
538
+
539
+ # @see the `==` method
540
+ # @param [Object] Object to be compared
541
+ def eql?(o)
542
+ self == o
543
+ end
544
+
545
+ # Calculates hash code according to all attributes.
546
+ # @return [Integer] Hash code
547
+ def hash
548
+ [id, tenant_id, company_id, scope_type, scope_id, facility_id, granularity, reporting_year, reporting_month, period_start, period_end, electricity_kwh, water_m3, notes, evidence_url, row_version, created_by, created_at, updated_by, updated_at, status, company, facility].hash
549
+ end
550
+
551
+ # Builds the object from hash
552
+ # @param [Hash] attributes Model attributes in the form of hash
553
+ # @return [Object] Returns the model itself
554
+ def self.build_from_hash(attributes)
555
+ return nil unless attributes.is_a?(Hash)
556
+ attributes = attributes.transform_keys(&:to_sym)
557
+ transformed_hash = {}
558
+ openapi_types.each_pair do |key, type|
559
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
560
+ transformed_hash["#{key}"] = nil
561
+ elsif type =~ /\AArray<(.*)>/i
562
+ # check to ensure the input is an array given that the attribute
563
+ # is documented as an array but the input is not
564
+ if attributes[attribute_map[key]].is_a?(Array)
565
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
566
+ end
567
+ elsif !attributes[attribute_map[key]].nil?
568
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
569
+ end
570
+ end
571
+ new(transformed_hash)
572
+ end
573
+
574
+ # Returns the object in the form of hash
575
+ # @return [Hash] Returns the object in the form of hash
576
+ def to_hash
577
+ hash = {}
578
+ self.class.attribute_map.each_pair do |attr, param|
579
+ value = self.send(attr)
580
+ if value.nil?
581
+ is_nullable = self.class.openapi_nullable.include?(attr)
582
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
583
+ end
584
+
585
+ hash[param] = _to_hash(value)
586
+ end
587
+ hash
588
+ end
589
+
590
+ end
591
+
592
+ end