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,436 @@
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
+ # 生产成品明细记录表(仅MTO时需要)
18
+ class ProductionSalesOrderApiDto < ApiModelBase
19
+ # 成品记录ID
20
+ attr_accessor :id
21
+
22
+ # 生产批次ID
23
+ attr_accessor :production_id
24
+
25
+ # 销售订单明细ID
26
+ attr_accessor :sales_order_line_id
27
+
28
+ # 为该订单生产数量
29
+ attr_accessor :quantity_produced
30
+
31
+ # 单位
32
+ attr_accessor :unit
33
+
34
+ # 租户ID
35
+ attr_accessor :tenant_id
36
+
37
+ # 环境类型:0正式,1测试
38
+ attr_accessor :environment_type
39
+
40
+ # 创建用户ID
41
+ attr_accessor :created_by
42
+
43
+ # 创建时间
44
+ attr_accessor :created_at
45
+
46
+ # 公司ID
47
+ attr_accessor :company_id
48
+
49
+ # -9 禁用, -1 删除, 0 正常
50
+ attr_accessor :status
51
+
52
+ # 修改用户ID
53
+ attr_accessor :updated_by
54
+
55
+ # 更新时间
56
+ attr_accessor :updated_at
57
+
58
+ # 生产自定义组合key(大申报使用)
59
+ attr_accessor :combination_key
60
+
61
+ # 生产分组类型(大申报使用)
62
+ attr_accessor :combination_type
63
+
64
+ # 单位名称
65
+ attr_accessor :u_name
66
+
67
+ # 订单编号
68
+ attr_accessor :order_number
69
+
70
+ # 销售订单日期。外部生产接口按订单号+日期+行号解析销售订单明细时使用。
71
+ attr_accessor :order_date
72
+
73
+ # 订单行号
74
+ attr_accessor :line_number
75
+
76
+ # 订单唯一标识
77
+ attr_accessor :unique_no
78
+
79
+ # 销售数量
80
+ attr_accessor :quantity
81
+
82
+ # 销售单数量
83
+ attr_accessor :so_quantity
84
+
85
+ # 销售单位
86
+ attr_accessor :so_unit
87
+
88
+ # 销售单位名称
89
+ attr_accessor :so_unit_name
90
+
91
+ # 生产单位
92
+ attr_accessor :production_unit
93
+
94
+ # 生产单位名称
95
+ attr_accessor :production_unit_name
96
+
97
+ # 链条是否审核通过
98
+ attr_accessor :chain_review_status
99
+
100
+ # Attribute mapping from ruby-style variable name to JSON key.
101
+ def self.attribute_map
102
+ {
103
+ :'id' => :'id',
104
+ :'production_id' => :'productionId',
105
+ :'sales_order_line_id' => :'salesOrderLineId',
106
+ :'quantity_produced' => :'quantityProduced',
107
+ :'unit' => :'unit',
108
+ :'tenant_id' => :'tenantId',
109
+ :'environment_type' => :'environmentType',
110
+ :'created_by' => :'createdBy',
111
+ :'created_at' => :'createdAt',
112
+ :'company_id' => :'companyId',
113
+ :'status' => :'status',
114
+ :'updated_by' => :'updatedBy',
115
+ :'updated_at' => :'updatedAt',
116
+ :'combination_key' => :'combinationKey',
117
+ :'combination_type' => :'combinationType',
118
+ :'u_name' => :'uName',
119
+ :'order_number' => :'orderNumber',
120
+ :'order_date' => :'orderDate',
121
+ :'line_number' => :'lineNumber',
122
+ :'unique_no' => :'uniqueNo',
123
+ :'quantity' => :'quantity',
124
+ :'so_quantity' => :'soQuantity',
125
+ :'so_unit' => :'soUnit',
126
+ :'so_unit_name' => :'soUnitName',
127
+ :'production_unit' => :'productionUnit',
128
+ :'production_unit_name' => :'productionUnitName',
129
+ :'chain_review_status' => :'chainReviewStatus'
130
+ }
131
+ end
132
+
133
+ # Returns attribute mapping this model knows about
134
+ def self.acceptable_attribute_map
135
+ attribute_map
136
+ end
137
+
138
+ # Returns all the JSON keys this model knows about
139
+ def self.acceptable_attributes
140
+ acceptable_attribute_map.values
141
+ end
142
+
143
+ # Attribute type mapping.
144
+ def self.openapi_types
145
+ {
146
+ :'id' => :'Integer',
147
+ :'production_id' => :'String',
148
+ :'sales_order_line_id' => :'String',
149
+ :'quantity_produced' => :'Float',
150
+ :'unit' => :'String',
151
+ :'tenant_id' => :'String',
152
+ :'environment_type' => :'Integer',
153
+ :'created_by' => :'String',
154
+ :'created_at' => :'Time',
155
+ :'company_id' => :'String',
156
+ :'status' => :'Integer',
157
+ :'updated_by' => :'String',
158
+ :'updated_at' => :'Time',
159
+ :'combination_key' => :'String',
160
+ :'combination_type' => :'String',
161
+ :'u_name' => :'String',
162
+ :'order_number' => :'String',
163
+ :'order_date' => :'Time',
164
+ :'line_number' => :'String',
165
+ :'unique_no' => :'String',
166
+ :'quantity' => :'Float',
167
+ :'so_quantity' => :'Float',
168
+ :'so_unit' => :'String',
169
+ :'so_unit_name' => :'String',
170
+ :'production_unit' => :'String',
171
+ :'production_unit_name' => :'String',
172
+ :'chain_review_status' => :'Boolean'
173
+ }
174
+ end
175
+
176
+ # List of attributes with nullable: true
177
+ def self.openapi_nullable
178
+ Set.new([
179
+ :'id',
180
+ :'production_id',
181
+ :'sales_order_line_id',
182
+ :'quantity_produced',
183
+ :'unit',
184
+ :'tenant_id',
185
+ :'environment_type',
186
+ :'created_by',
187
+ :'created_at',
188
+ :'company_id',
189
+ :'status',
190
+ :'updated_by',
191
+ :'updated_at',
192
+ :'combination_key',
193
+ :'combination_type',
194
+ :'u_name',
195
+ :'order_number',
196
+ :'order_date',
197
+ :'line_number',
198
+ :'unique_no',
199
+ :'quantity',
200
+ :'so_quantity',
201
+ :'so_unit',
202
+ :'so_unit_name',
203
+ :'production_unit',
204
+ :'production_unit_name',
205
+ :'chain_review_status'
206
+ ])
207
+ end
208
+
209
+ # Initializes the object
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ def initialize(attributes = {})
212
+ if (!attributes.is_a?(Hash))
213
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TachainSdk::ProductionSalesOrderApiDto` initialize method"
214
+ end
215
+
216
+ # check to see if the attribute exists and convert string to symbol for hash key
217
+ acceptable_attribute_map = self.class.acceptable_attribute_map
218
+ attributes = attributes.each_with_object({}) { |(k, v), h|
219
+ if (!acceptable_attribute_map.key?(k.to_sym))
220
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TachainSdk::ProductionSalesOrderApiDto`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
221
+ end
222
+ h[k.to_sym] = v
223
+ }
224
+
225
+ if attributes.key?(:'id')
226
+ self.id = attributes[:'id']
227
+ end
228
+
229
+ if attributes.key?(:'production_id')
230
+ self.production_id = attributes[:'production_id']
231
+ end
232
+
233
+ if attributes.key?(:'sales_order_line_id')
234
+ self.sales_order_line_id = attributes[:'sales_order_line_id']
235
+ end
236
+
237
+ if attributes.key?(:'quantity_produced')
238
+ self.quantity_produced = attributes[:'quantity_produced']
239
+ end
240
+
241
+ if attributes.key?(:'unit')
242
+ self.unit = attributes[:'unit']
243
+ end
244
+
245
+ if attributes.key?(:'tenant_id')
246
+ self.tenant_id = attributes[:'tenant_id']
247
+ end
248
+
249
+ if attributes.key?(:'environment_type')
250
+ self.environment_type = attributes[:'environment_type']
251
+ end
252
+
253
+ if attributes.key?(:'created_by')
254
+ self.created_by = attributes[:'created_by']
255
+ end
256
+
257
+ if attributes.key?(:'created_at')
258
+ self.created_at = attributes[:'created_at']
259
+ end
260
+
261
+ if attributes.key?(:'company_id')
262
+ self.company_id = attributes[:'company_id']
263
+ end
264
+
265
+ if attributes.key?(:'status')
266
+ self.status = attributes[:'status']
267
+ end
268
+
269
+ if attributes.key?(:'updated_by')
270
+ self.updated_by = attributes[:'updated_by']
271
+ end
272
+
273
+ if attributes.key?(:'updated_at')
274
+ self.updated_at = attributes[:'updated_at']
275
+ end
276
+
277
+ if attributes.key?(:'combination_key')
278
+ self.combination_key = attributes[:'combination_key']
279
+ end
280
+
281
+ if attributes.key?(:'combination_type')
282
+ self.combination_type = attributes[:'combination_type']
283
+ end
284
+
285
+ if attributes.key?(:'u_name')
286
+ self.u_name = attributes[:'u_name']
287
+ end
288
+
289
+ if attributes.key?(:'order_number')
290
+ self.order_number = attributes[:'order_number']
291
+ end
292
+
293
+ if attributes.key?(:'order_date')
294
+ self.order_date = attributes[:'order_date']
295
+ end
296
+
297
+ if attributes.key?(:'line_number')
298
+ self.line_number = attributes[:'line_number']
299
+ end
300
+
301
+ if attributes.key?(:'unique_no')
302
+ self.unique_no = attributes[:'unique_no']
303
+ end
304
+
305
+ if attributes.key?(:'quantity')
306
+ self.quantity = attributes[:'quantity']
307
+ end
308
+
309
+ if attributes.key?(:'so_quantity')
310
+ self.so_quantity = attributes[:'so_quantity']
311
+ end
312
+
313
+ if attributes.key?(:'so_unit')
314
+ self.so_unit = attributes[:'so_unit']
315
+ end
316
+
317
+ if attributes.key?(:'so_unit_name')
318
+ self.so_unit_name = attributes[:'so_unit_name']
319
+ end
320
+
321
+ if attributes.key?(:'production_unit')
322
+ self.production_unit = attributes[:'production_unit']
323
+ end
324
+
325
+ if attributes.key?(:'production_unit_name')
326
+ self.production_unit_name = attributes[:'production_unit_name']
327
+ end
328
+
329
+ if attributes.key?(:'chain_review_status')
330
+ self.chain_review_status = attributes[:'chain_review_status']
331
+ end
332
+ end
333
+
334
+ # Show invalid properties with the reasons. Usually used together with valid?
335
+ # @return Array for valid properties with the reasons
336
+ def list_invalid_properties
337
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
338
+ invalid_properties = Array.new
339
+ invalid_properties
340
+ end
341
+
342
+ # Check to see if the all the properties in the model are valid
343
+ # @return true if the model is valid
344
+ def valid?
345
+ warn '[DEPRECATED] the `valid?` method is obsolete'
346
+ true
347
+ end
348
+
349
+ # Checks equality by comparing each attribute.
350
+ # @param [Object] Object to be compared
351
+ def ==(o)
352
+ return true if self.equal?(o)
353
+ self.class == o.class &&
354
+ id == o.id &&
355
+ production_id == o.production_id &&
356
+ sales_order_line_id == o.sales_order_line_id &&
357
+ quantity_produced == o.quantity_produced &&
358
+ unit == o.unit &&
359
+ tenant_id == o.tenant_id &&
360
+ environment_type == o.environment_type &&
361
+ created_by == o.created_by &&
362
+ created_at == o.created_at &&
363
+ company_id == o.company_id &&
364
+ status == o.status &&
365
+ updated_by == o.updated_by &&
366
+ updated_at == o.updated_at &&
367
+ combination_key == o.combination_key &&
368
+ combination_type == o.combination_type &&
369
+ u_name == o.u_name &&
370
+ order_number == o.order_number &&
371
+ order_date == o.order_date &&
372
+ line_number == o.line_number &&
373
+ unique_no == o.unique_no &&
374
+ quantity == o.quantity &&
375
+ so_quantity == o.so_quantity &&
376
+ so_unit == o.so_unit &&
377
+ so_unit_name == o.so_unit_name &&
378
+ production_unit == o.production_unit &&
379
+ production_unit_name == o.production_unit_name &&
380
+ chain_review_status == o.chain_review_status
381
+ end
382
+
383
+ # @see the `==` method
384
+ # @param [Object] Object to be compared
385
+ def eql?(o)
386
+ self == o
387
+ end
388
+
389
+ # Calculates hash code according to all attributes.
390
+ # @return [Integer] Hash code
391
+ def hash
392
+ [id, production_id, sales_order_line_id, quantity_produced, unit, tenant_id, environment_type, created_by, created_at, company_id, status, updated_by, updated_at, combination_key, combination_type, u_name, order_number, order_date, line_number, unique_no, quantity, so_quantity, so_unit, so_unit_name, production_unit, production_unit_name, chain_review_status].hash
393
+ end
394
+
395
+ # Builds the object from hash
396
+ # @param [Hash] attributes Model attributes in the form of hash
397
+ # @return [Object] Returns the model itself
398
+ def self.build_from_hash(attributes)
399
+ return nil unless attributes.is_a?(Hash)
400
+ attributes = attributes.transform_keys(&:to_sym)
401
+ transformed_hash = {}
402
+ openapi_types.each_pair do |key, type|
403
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
404
+ transformed_hash["#{key}"] = nil
405
+ elsif type =~ /\AArray<(.*)>/i
406
+ # check to ensure the input is an array given that the attribute
407
+ # is documented as an array but the input is not
408
+ if attributes[attribute_map[key]].is_a?(Array)
409
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
410
+ end
411
+ elsif !attributes[attribute_map[key]].nil?
412
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
413
+ end
414
+ end
415
+ new(transformed_hash)
416
+ end
417
+
418
+ # Returns the object in the form of hash
419
+ # @return [Hash] Returns the object in the form of hash
420
+ def to_hash
421
+ hash = {}
422
+ self.class.attribute_map.each_pair do |attr, param|
423
+ value = self.send(attr)
424
+ if value.nil?
425
+ is_nullable = self.class.openapi_nullable.include?(attr)
426
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
427
+ end
428
+
429
+ hash[param] = _to_hash(value)
430
+ end
431
+ hash
432
+ end
433
+
434
+ end
435
+
436
+ end
@@ -0,0 +1,270 @@
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
+ class ResultApiEnum < ApiModelBase
18
+ attr_accessor :type
19
+
20
+ attr_accessor :code
21
+
22
+ attr_accessor :name
23
+
24
+ attr_accessor :ext_code
25
+
26
+ attr_accessor :extensions
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'type' => :'type',
32
+ :'code' => :'code',
33
+ :'name' => :'name',
34
+ :'ext_code' => :'extCode',
35
+ :'extensions' => :'extensions'
36
+ }
37
+ end
38
+
39
+ # Returns attribute mapping this model knows about
40
+ def self.acceptable_attribute_map
41
+ attribute_map
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ acceptable_attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'type' => :'String',
53
+ :'code' => :'String',
54
+ :'name' => :'String',
55
+ :'ext_code' => :'String',
56
+ :'extensions' => :'Hash<String, String>'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TachainSdk::ResultApiEnum` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TachainSdk::ResultApiEnum`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'type')
83
+ self.type = attributes[:'type']
84
+ else
85
+ self.type = nil
86
+ end
87
+
88
+ if attributes.key?(:'code')
89
+ self.code = attributes[:'code']
90
+ else
91
+ self.code = nil
92
+ end
93
+
94
+ if attributes.key?(:'name')
95
+ self.name = attributes[:'name']
96
+ else
97
+ self.name = nil
98
+ end
99
+
100
+ if attributes.key?(:'ext_code')
101
+ self.ext_code = attributes[:'ext_code']
102
+ else
103
+ self.ext_code = nil
104
+ end
105
+
106
+ if attributes.key?(:'extensions')
107
+ if (value = attributes[:'extensions']).is_a?(Hash)
108
+ self.extensions = value
109
+ end
110
+ else
111
+ self.extensions = nil
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
119
+ invalid_properties = Array.new
120
+ if @type.nil?
121
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
122
+ end
123
+
124
+ if @code.nil?
125
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
126
+ end
127
+
128
+ if @name.nil?
129
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
130
+ end
131
+
132
+ if @ext_code.nil?
133
+ invalid_properties.push('invalid value for "ext_code", ext_code cannot be nil.')
134
+ end
135
+
136
+ if @extensions.nil?
137
+ invalid_properties.push('invalid value for "extensions", extensions cannot be nil.')
138
+ end
139
+
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ warn '[DEPRECATED] the `valid?` method is obsolete'
147
+ return false if @type.nil?
148
+ return false if @code.nil?
149
+ return false if @name.nil?
150
+ return false if @ext_code.nil?
151
+ return false if @extensions.nil?
152
+ true
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] type Value to be assigned
157
+ def type=(type)
158
+ if type.nil?
159
+ fail ArgumentError, 'type cannot be nil'
160
+ end
161
+
162
+ @type = type
163
+ end
164
+
165
+ # Custom attribute writer method with validation
166
+ # @param [Object] code Value to be assigned
167
+ def code=(code)
168
+ if code.nil?
169
+ fail ArgumentError, 'code cannot be nil'
170
+ end
171
+
172
+ @code = code
173
+ end
174
+
175
+ # Custom attribute writer method with validation
176
+ # @param [Object] name Value to be assigned
177
+ def name=(name)
178
+ if name.nil?
179
+ fail ArgumentError, 'name cannot be nil'
180
+ end
181
+
182
+ @name = name
183
+ end
184
+
185
+ # Custom attribute writer method with validation
186
+ # @param [Object] ext_code Value to be assigned
187
+ def ext_code=(ext_code)
188
+ if ext_code.nil?
189
+ fail ArgumentError, 'ext_code cannot be nil'
190
+ end
191
+
192
+ @ext_code = ext_code
193
+ end
194
+
195
+ # Custom attribute writer method with validation
196
+ # @param [Object] extensions Value to be assigned
197
+ def extensions=(extensions)
198
+ if extensions.nil?
199
+ fail ArgumentError, 'extensions cannot be nil'
200
+ end
201
+
202
+ @extensions = extensions
203
+ end
204
+
205
+ # Checks equality by comparing each attribute.
206
+ # @param [Object] Object to be compared
207
+ def ==(o)
208
+ return true if self.equal?(o)
209
+ self.class == o.class &&
210
+ type == o.type &&
211
+ code == o.code &&
212
+ name == o.name &&
213
+ ext_code == o.ext_code &&
214
+ extensions == o.extensions
215
+ end
216
+
217
+ # @see the `==` method
218
+ # @param [Object] Object to be compared
219
+ def eql?(o)
220
+ self == o
221
+ end
222
+
223
+ # Calculates hash code according to all attributes.
224
+ # @return [Integer] Hash code
225
+ def hash
226
+ [type, code, name, ext_code, extensions].hash
227
+ end
228
+
229
+ # Builds the object from hash
230
+ # @param [Hash] attributes Model attributes in the form of hash
231
+ # @return [Object] Returns the model itself
232
+ def self.build_from_hash(attributes)
233
+ return nil unless attributes.is_a?(Hash)
234
+ attributes = attributes.transform_keys(&:to_sym)
235
+ transformed_hash = {}
236
+ openapi_types.each_pair do |key, type|
237
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
238
+ transformed_hash["#{key}"] = nil
239
+ elsif type =~ /\AArray<(.*)>/i
240
+ # check to ensure the input is an array given that the attribute
241
+ # is documented as an array but the input is not
242
+ if attributes[attribute_map[key]].is_a?(Array)
243
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
244
+ end
245
+ elsif !attributes[attribute_map[key]].nil?
246
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
247
+ end
248
+ end
249
+ new(transformed_hash)
250
+ end
251
+
252
+ # Returns the object in the form of hash
253
+ # @return [Hash] Returns the object in the form of hash
254
+ def to_hash
255
+ hash = {}
256
+ self.class.attribute_map.each_pair do |attr, param|
257
+ value = self.send(attr)
258
+ if value.nil?
259
+ is_nullable = self.class.openapi_nullable.include?(attr)
260
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
261
+ end
262
+
263
+ hash[param] = _to_hash(value)
264
+ end
265
+ hash
266
+ end
267
+
268
+ end
269
+
270
+ end