biz_api 3.9.1

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 (136) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +155 -0
  4. data/Rakefile +10 -0
  5. data/biz_api.gemspec +39 -0
  6. data/docs/AppInfo.md +22 -0
  7. data/docs/AuthRequest.md +26 -0
  8. data/docs/BizEvent.md +50 -0
  9. data/docs/BizEventsHelpdeskApi.md +157 -0
  10. data/docs/CartItem.md +28 -0
  11. data/docs/Creditor.md +26 -0
  12. data/docs/CtReceiptModelResponse.md +72 -0
  13. data/docs/Debtor.md +36 -0
  14. data/docs/DebtorPosition.md +24 -0
  15. data/docs/Details.md +22 -0
  16. data/docs/HomeApi.md +81 -0
  17. data/docs/IOTransactionsRESTAPIsApi.md +328 -0
  18. data/docs/Info.md +34 -0
  19. data/docs/InfoNotice.md +38 -0
  20. data/docs/InfoTransaction.md +26 -0
  21. data/docs/InfoTransactionView.md +38 -0
  22. data/docs/MBD.md +26 -0
  23. data/docs/MapEntry.md +20 -0
  24. data/docs/NoticeDetailResponse.md +20 -0
  25. data/docs/NoticeListItem.md +32 -0
  26. data/docs/NoticeListWrapResponse.md +18 -0
  27. data/docs/PageInfo.md +24 -0
  28. data/docs/PaidNoticeRESTAPIsApi.md +322 -0
  29. data/docs/Payer.md +36 -0
  30. data/docs/PaymentAuthorizationRequest.md +28 -0
  31. data/docs/PaymentInfo.md +50 -0
  32. data/docs/PaymentReceiptsRESTAPIsApi.md +161 -0
  33. data/docs/ProblemJson.md +22 -0
  34. data/docs/Psp.md +30 -0
  35. data/docs/Transaction.md +44 -0
  36. data/docs/TransactionDetailResponse.md +20 -0
  37. data/docs/TransactionDetails.md +28 -0
  38. data/docs/TransactionListItem.md +32 -0
  39. data/docs/TransactionListWrapResponse.md +20 -0
  40. data/docs/TransactionPsp.md +22 -0
  41. data/docs/Transfer.md +34 -0
  42. data/docs/TransferPA.md +32 -0
  43. data/docs/User.md +30 -0
  44. data/docs/UserDetail.md +20 -0
  45. data/docs/WalletInfo.md +24 -0
  46. data/docs/WalletItem.md +34 -0
  47. data/git_push.sh +57 -0
  48. data/lib/biz_api/api/biz_events_helpdesk_api.rb +156 -0
  49. data/lib/biz_api/api/home_api.rb +82 -0
  50. data/lib/biz_api/api/io_transactions_restapis_api.rb +334 -0
  51. data/lib/biz_api/api/paid_notice_restapis_api.rb +328 -0
  52. data/lib/biz_api/api/payment_receipts_restapis_api.rb +168 -0
  53. data/lib/biz_api/api_client.rb +394 -0
  54. data/lib/biz_api/api_error.rb +58 -0
  55. data/lib/biz_api/configuration.rb +333 -0
  56. data/lib/biz_api/models/app_info.rb +232 -0
  57. data/lib/biz_api/models/auth_request.rb +250 -0
  58. data/lib/biz_api/models/biz_event.rb +396 -0
  59. data/lib/biz_api/models/cart_item.rb +287 -0
  60. data/lib/biz_api/models/creditor.rb +250 -0
  61. data/lib/biz_api/models/ct_receipt_model_response.rb +552 -0
  62. data/lib/biz_api/models/debtor.rb +295 -0
  63. data/lib/biz_api/models/debtor_position.rb +241 -0
  64. data/lib/biz_api/models/details.rb +232 -0
  65. data/lib/biz_api/models/info.rb +286 -0
  66. data/lib/biz_api/models/info_notice.rb +392 -0
  67. data/lib/biz_api/models/info_transaction.rb +250 -0
  68. data/lib/biz_api/models/info_transaction_view.rb +350 -0
  69. data/lib/biz_api/models/map_entry.rb +223 -0
  70. data/lib/biz_api/models/mbd.rb +250 -0
  71. data/lib/biz_api/models/notice_detail_response.rb +225 -0
  72. data/lib/biz_api/models/notice_list_item.rb +326 -0
  73. data/lib/biz_api/models/notice_list_wrap_response.rb +223 -0
  74. data/lib/biz_api/models/page_info.rb +273 -0
  75. data/lib/biz_api/models/payer.rb +295 -0
  76. data/lib/biz_api/models/payment_authorization_request.rb +259 -0
  77. data/lib/biz_api/models/payment_info.rb +360 -0
  78. data/lib/biz_api/models/problem_json.rb +259 -0
  79. data/lib/biz_api/models/psp.rb +268 -0
  80. data/lib/biz_api/models/transaction.rb +331 -0
  81. data/lib/biz_api/models/transaction_detail_response.rb +225 -0
  82. data/lib/biz_api/models/transaction_details.rb +259 -0
  83. data/lib/biz_api/models/transaction_list_item.rb +277 -0
  84. data/lib/biz_api/models/transaction_list_wrap_response.rb +225 -0
  85. data/lib/biz_api/models/transaction_psp.rb +232 -0
  86. data/lib/biz_api/models/transfer.rb +288 -0
  87. data/lib/biz_api/models/transfer_pa.rb +345 -0
  88. data/lib/biz_api/models/user.rb +302 -0
  89. data/lib/biz_api/models/user_detail.rb +230 -0
  90. data/lib/biz_api/models/wallet_info.rb +241 -0
  91. data/lib/biz_api/models/wallet_item.rb +322 -0
  92. data/lib/biz_api/version.rb +15 -0
  93. data/lib/biz_api.rb +80 -0
  94. data/spec/api/biz_events_helpdesk_api_spec.rb +60 -0
  95. data/spec/api/home_api_spec.rb +47 -0
  96. data/spec/api/io_transactions_restapis_api_spec.rb +96 -0
  97. data/spec/api/paid_notice_restapis_api_spec.rb +93 -0
  98. data/spec/api/payment_receipts_restapis_api_spec.rb +62 -0
  99. data/spec/models/app_info_spec.rb +48 -0
  100. data/spec/models/auth_request_spec.rb +60 -0
  101. data/spec/models/biz_event_spec.rb +136 -0
  102. data/spec/models/cart_item_spec.rb +66 -0
  103. data/spec/models/creditor_spec.rb +60 -0
  104. data/spec/models/ct_receipt_model_response_spec.rb +198 -0
  105. data/spec/models/debtor_position_spec.rb +54 -0
  106. data/spec/models/debtor_spec.rb +90 -0
  107. data/spec/models/details_spec.rb +48 -0
  108. data/spec/models/info_notice_spec.rb +104 -0
  109. data/spec/models/info_spec.rb +84 -0
  110. data/spec/models/info_transaction_spec.rb +60 -0
  111. data/spec/models/info_transaction_view_spec.rb +104 -0
  112. data/spec/models/map_entry_spec.rb +42 -0
  113. data/spec/models/mbd_spec.rb +60 -0
  114. data/spec/models/notice_detail_response_spec.rb +42 -0
  115. data/spec/models/notice_list_item_spec.rb +78 -0
  116. data/spec/models/notice_list_wrap_response_spec.rb +36 -0
  117. data/spec/models/page_info_spec.rb +54 -0
  118. data/spec/models/payer_spec.rb +90 -0
  119. data/spec/models/payment_authorization_request_spec.rb +66 -0
  120. data/spec/models/payment_info_spec.rb +132 -0
  121. data/spec/models/problem_json_spec.rb +48 -0
  122. data/spec/models/psp_spec.rb +72 -0
  123. data/spec/models/transaction_detail_response_spec.rb +42 -0
  124. data/spec/models/transaction_details_spec.rb +66 -0
  125. data/spec/models/transaction_list_item_spec.rb +78 -0
  126. data/spec/models/transaction_list_wrap_response_spec.rb +42 -0
  127. data/spec/models/transaction_psp_spec.rb +48 -0
  128. data/spec/models/transaction_spec.rb +114 -0
  129. data/spec/models/transfer_pa_spec.rb +78 -0
  130. data/spec/models/transfer_spec.rb +84 -0
  131. data/spec/models/user_detail_spec.rb +42 -0
  132. data/spec/models/user_spec.rb +76 -0
  133. data/spec/models/wallet_info_spec.rb +54 -0
  134. data/spec/models/wallet_item_spec.rb +88 -0
  135. data/spec/spec_helper.rb +111 -0
  136. metadata +259 -0
@@ -0,0 +1,552 @@
1
+ =begin
2
+ #Biz-Events Service
3
+
4
+ #Microservice for exposing REST APIs about payment receipts.
5
+
6
+ The version of the OpenAPI document: 0.1.72
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module BizReceipts
17
+ class CtReceiptModelResponse
18
+ attr_accessor :receipt_id
19
+
20
+ attr_accessor :notice_number
21
+
22
+ attr_accessor :fiscal_code
23
+
24
+ attr_accessor :outcome
25
+
26
+ attr_accessor :creditor_reference_id
27
+
28
+ attr_accessor :payment_amount
29
+
30
+ attr_accessor :description
31
+
32
+ attr_accessor :company_name
33
+
34
+ attr_accessor :office_name
35
+
36
+ attr_accessor :debtor
37
+
38
+ attr_accessor :transfer_list
39
+
40
+ attr_accessor :id_psp
41
+
42
+ attr_accessor :psp_fiscal_code
43
+
44
+ attr_accessor :psp_partita_iva
45
+
46
+ attr_accessor :psp_company_name
47
+
48
+ attr_accessor :id_channel
49
+
50
+ attr_accessor :channel_description
51
+
52
+ attr_accessor :payer
53
+
54
+ attr_accessor :payment_method
55
+
56
+ attr_accessor :fee
57
+
58
+ attr_accessor :primary_ci_incurred_fee
59
+
60
+ attr_accessor :id_bundle
61
+
62
+ attr_accessor :id_ci_bundle
63
+
64
+ attr_accessor :payment_date_time
65
+
66
+ attr_accessor :payment_date_time_formatted
67
+
68
+ attr_accessor :application_date
69
+
70
+ attr_accessor :transfer_date
71
+
72
+ attr_accessor :metadata
73
+
74
+ # Attribute mapping from ruby-style variable name to JSON key.
75
+ def self.attribute_map
76
+ {
77
+ :'receipt_id' => :'receiptId',
78
+ :'notice_number' => :'noticeNumber',
79
+ :'fiscal_code' => :'fiscalCode',
80
+ :'outcome' => :'outcome',
81
+ :'creditor_reference_id' => :'creditorReferenceId',
82
+ :'payment_amount' => :'paymentAmount',
83
+ :'description' => :'description',
84
+ :'company_name' => :'companyName',
85
+ :'office_name' => :'officeName',
86
+ :'debtor' => :'debtor',
87
+ :'transfer_list' => :'transferList',
88
+ :'id_psp' => :'idPSP',
89
+ :'psp_fiscal_code' => :'pspFiscalCode',
90
+ :'psp_partita_iva' => :'pspPartitaIVA',
91
+ :'psp_company_name' => :'pspCompanyName',
92
+ :'id_channel' => :'idChannel',
93
+ :'channel_description' => :'channelDescription',
94
+ :'payer' => :'payer',
95
+ :'payment_method' => :'paymentMethod',
96
+ :'fee' => :'fee',
97
+ :'primary_ci_incurred_fee' => :'primaryCiIncurredFee',
98
+ :'id_bundle' => :'idBundle',
99
+ :'id_ci_bundle' => :'idCiBundle',
100
+ :'payment_date_time' => :'paymentDateTime',
101
+ :'payment_date_time_formatted' => :'paymentDateTimeFormatted',
102
+ :'application_date' => :'applicationDate',
103
+ :'transfer_date' => :'transferDate',
104
+ :'metadata' => :'metadata'
105
+ }
106
+ end
107
+
108
+ # Returns all the JSON keys this model knows about
109
+ def self.acceptable_attributes
110
+ attribute_map.values
111
+ end
112
+
113
+ # Attribute type mapping.
114
+ def self.openapi_types
115
+ {
116
+ :'receipt_id' => :'String',
117
+ :'notice_number' => :'String',
118
+ :'fiscal_code' => :'String',
119
+ :'outcome' => :'String',
120
+ :'creditor_reference_id' => :'String',
121
+ :'payment_amount' => :'Float',
122
+ :'description' => :'String',
123
+ :'company_name' => :'String',
124
+ :'office_name' => :'String',
125
+ :'debtor' => :'Debtor',
126
+ :'transfer_list' => :'Array<TransferPA>',
127
+ :'id_psp' => :'String',
128
+ :'psp_fiscal_code' => :'String',
129
+ :'psp_partita_iva' => :'String',
130
+ :'psp_company_name' => :'String',
131
+ :'id_channel' => :'String',
132
+ :'channel_description' => :'String',
133
+ :'payer' => :'Payer',
134
+ :'payment_method' => :'String',
135
+ :'fee' => :'Float',
136
+ :'primary_ci_incurred_fee' => :'Float',
137
+ :'id_bundle' => :'String',
138
+ :'id_ci_bundle' => :'String',
139
+ :'payment_date_time' => :'Date',
140
+ :'payment_date_time_formatted' => :'Time',
141
+ :'application_date' => :'Date',
142
+ :'transfer_date' => :'Date',
143
+ :'metadata' => :'Array<MapEntry>'
144
+ }
145
+ end
146
+
147
+ # List of attributes with nullable: true
148
+ def self.openapi_nullable
149
+ Set.new([
150
+ ])
151
+ end
152
+
153
+ # Initializes the object
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ def initialize(attributes = {})
156
+ if (!attributes.is_a?(Hash))
157
+ fail ArgumentError, "The input argument (attributes) must be a hash in `BizReceipts::CtReceiptModelResponse` initialize method"
158
+ end
159
+
160
+ # check to see if the attribute exists and convert string to symbol for hash key
161
+ attributes = attributes.each_with_object({}) { |(k, v), h|
162
+ if (!self.class.attribute_map.key?(k.to_sym))
163
+ fail ArgumentError, "`#{k}` is not a valid attribute in `BizReceipts::CtReceiptModelResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
164
+ end
165
+ h[k.to_sym] = v
166
+ }
167
+
168
+ if attributes.key?(:'receipt_id')
169
+ self.receipt_id = attributes[:'receipt_id']
170
+ else
171
+ self.receipt_id = nil
172
+ end
173
+
174
+ if attributes.key?(:'notice_number')
175
+ self.notice_number = attributes[:'notice_number']
176
+ else
177
+ self.notice_number = nil
178
+ end
179
+
180
+ if attributes.key?(:'fiscal_code')
181
+ self.fiscal_code = attributes[:'fiscal_code']
182
+ else
183
+ self.fiscal_code = nil
184
+ end
185
+
186
+ if attributes.key?(:'outcome')
187
+ self.outcome = attributes[:'outcome']
188
+ else
189
+ self.outcome = nil
190
+ end
191
+
192
+ if attributes.key?(:'creditor_reference_id')
193
+ self.creditor_reference_id = attributes[:'creditor_reference_id']
194
+ else
195
+ self.creditor_reference_id = nil
196
+ end
197
+
198
+ if attributes.key?(:'payment_amount')
199
+ self.payment_amount = attributes[:'payment_amount']
200
+ else
201
+ self.payment_amount = nil
202
+ end
203
+
204
+ if attributes.key?(:'description')
205
+ self.description = attributes[:'description']
206
+ else
207
+ self.description = nil
208
+ end
209
+
210
+ if attributes.key?(:'company_name')
211
+ self.company_name = attributes[:'company_name']
212
+ else
213
+ self.company_name = nil
214
+ end
215
+
216
+ if attributes.key?(:'office_name')
217
+ self.office_name = attributes[:'office_name']
218
+ end
219
+
220
+ if attributes.key?(:'debtor')
221
+ self.debtor = attributes[:'debtor']
222
+ else
223
+ self.debtor = nil
224
+ end
225
+
226
+ if attributes.key?(:'transfer_list')
227
+ if (value = attributes[:'transfer_list']).is_a?(Array)
228
+ self.transfer_list = value
229
+ end
230
+ else
231
+ self.transfer_list = nil
232
+ end
233
+
234
+ if attributes.key?(:'id_psp')
235
+ self.id_psp = attributes[:'id_psp']
236
+ else
237
+ self.id_psp = nil
238
+ end
239
+
240
+ if attributes.key?(:'psp_fiscal_code')
241
+ self.psp_fiscal_code = attributes[:'psp_fiscal_code']
242
+ end
243
+
244
+ if attributes.key?(:'psp_partita_iva')
245
+ self.psp_partita_iva = attributes[:'psp_partita_iva']
246
+ end
247
+
248
+ if attributes.key?(:'psp_company_name')
249
+ self.psp_company_name = attributes[:'psp_company_name']
250
+ else
251
+ self.psp_company_name = nil
252
+ end
253
+
254
+ if attributes.key?(:'id_channel')
255
+ self.id_channel = attributes[:'id_channel']
256
+ else
257
+ self.id_channel = nil
258
+ end
259
+
260
+ if attributes.key?(:'channel_description')
261
+ self.channel_description = attributes[:'channel_description']
262
+ end
263
+
264
+ if attributes.key?(:'payer')
265
+ self.payer = attributes[:'payer']
266
+ end
267
+
268
+ if attributes.key?(:'payment_method')
269
+ self.payment_method = attributes[:'payment_method']
270
+ end
271
+
272
+ if attributes.key?(:'fee')
273
+ self.fee = attributes[:'fee']
274
+ end
275
+
276
+ if attributes.key?(:'primary_ci_incurred_fee')
277
+ self.primary_ci_incurred_fee = attributes[:'primary_ci_incurred_fee']
278
+ end
279
+
280
+ if attributes.key?(:'id_bundle')
281
+ self.id_bundle = attributes[:'id_bundle']
282
+ end
283
+
284
+ if attributes.key?(:'id_ci_bundle')
285
+ self.id_ci_bundle = attributes[:'id_ci_bundle']
286
+ end
287
+
288
+ if attributes.key?(:'payment_date_time')
289
+ self.payment_date_time = attributes[:'payment_date_time']
290
+ end
291
+
292
+ if attributes.key?(:'payment_date_time_formatted')
293
+ self.payment_date_time_formatted = attributes[:'payment_date_time_formatted']
294
+ end
295
+
296
+ if attributes.key?(:'application_date')
297
+ self.application_date = attributes[:'application_date']
298
+ end
299
+
300
+ if attributes.key?(:'transfer_date')
301
+ self.transfer_date = attributes[:'transfer_date']
302
+ end
303
+
304
+ if attributes.key?(:'metadata')
305
+ if (value = attributes[:'metadata']).is_a?(Array)
306
+ self.metadata = value
307
+ end
308
+ end
309
+ end
310
+
311
+ # Show invalid properties with the reasons. Usually used together with valid?
312
+ # @return Array for valid properties with the reasons
313
+ def list_invalid_properties
314
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
315
+ invalid_properties = Array.new
316
+ if @receipt_id.nil?
317
+ invalid_properties.push('invalid value for "receipt_id", receipt_id cannot be nil.')
318
+ end
319
+
320
+ if @notice_number.nil?
321
+ invalid_properties.push('invalid value for "notice_number", notice_number cannot be nil.')
322
+ end
323
+
324
+ if @fiscal_code.nil?
325
+ invalid_properties.push('invalid value for "fiscal_code", fiscal_code cannot be nil.')
326
+ end
327
+
328
+ if @outcome.nil?
329
+ invalid_properties.push('invalid value for "outcome", outcome cannot be nil.')
330
+ end
331
+
332
+ if @creditor_reference_id.nil?
333
+ invalid_properties.push('invalid value for "creditor_reference_id", creditor_reference_id cannot be nil.')
334
+ end
335
+
336
+ if @payment_amount.nil?
337
+ invalid_properties.push('invalid value for "payment_amount", payment_amount cannot be nil.')
338
+ end
339
+
340
+ if @description.nil?
341
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
342
+ end
343
+
344
+ if @company_name.nil?
345
+ invalid_properties.push('invalid value for "company_name", company_name cannot be nil.')
346
+ end
347
+
348
+ if @debtor.nil?
349
+ invalid_properties.push('invalid value for "debtor", debtor cannot be nil.')
350
+ end
351
+
352
+ if @transfer_list.nil?
353
+ invalid_properties.push('invalid value for "transfer_list", transfer_list cannot be nil.')
354
+ end
355
+
356
+ if @id_psp.nil?
357
+ invalid_properties.push('invalid value for "id_psp", id_psp cannot be nil.')
358
+ end
359
+
360
+ if @psp_company_name.nil?
361
+ invalid_properties.push('invalid value for "psp_company_name", psp_company_name cannot be nil.')
362
+ end
363
+
364
+ if @id_channel.nil?
365
+ invalid_properties.push('invalid value for "id_channel", id_channel cannot be nil.')
366
+ end
367
+
368
+ invalid_properties
369
+ end
370
+
371
+ # Check to see if the all the properties in the model are valid
372
+ # @return true if the model is valid
373
+ def valid?
374
+ warn '[DEPRECATED] the `valid?` method is obsolete'
375
+ return false if @receipt_id.nil?
376
+ return false if @notice_number.nil?
377
+ return false if @fiscal_code.nil?
378
+ return false if @outcome.nil?
379
+ return false if @creditor_reference_id.nil?
380
+ return false if @payment_amount.nil?
381
+ return false if @description.nil?
382
+ return false if @company_name.nil?
383
+ return false if @debtor.nil?
384
+ return false if @transfer_list.nil?
385
+ return false if @id_psp.nil?
386
+ return false if @psp_company_name.nil?
387
+ return false if @id_channel.nil?
388
+ true
389
+ end
390
+
391
+ # Checks equality by comparing each attribute.
392
+ # @param [Object] Object to be compared
393
+ def ==(o)
394
+ return true if self.equal?(o)
395
+ self.class == o.class &&
396
+ receipt_id == o.receipt_id &&
397
+ notice_number == o.notice_number &&
398
+ fiscal_code == o.fiscal_code &&
399
+ outcome == o.outcome &&
400
+ creditor_reference_id == o.creditor_reference_id &&
401
+ payment_amount == o.payment_amount &&
402
+ description == o.description &&
403
+ company_name == o.company_name &&
404
+ office_name == o.office_name &&
405
+ debtor == o.debtor &&
406
+ transfer_list == o.transfer_list &&
407
+ id_psp == o.id_psp &&
408
+ psp_fiscal_code == o.psp_fiscal_code &&
409
+ psp_partita_iva == o.psp_partita_iva &&
410
+ psp_company_name == o.psp_company_name &&
411
+ id_channel == o.id_channel &&
412
+ channel_description == o.channel_description &&
413
+ payer == o.payer &&
414
+ payment_method == o.payment_method &&
415
+ fee == o.fee &&
416
+ primary_ci_incurred_fee == o.primary_ci_incurred_fee &&
417
+ id_bundle == o.id_bundle &&
418
+ id_ci_bundle == o.id_ci_bundle &&
419
+ payment_date_time == o.payment_date_time &&
420
+ payment_date_time_formatted == o.payment_date_time_formatted &&
421
+ application_date == o.application_date &&
422
+ transfer_date == o.transfer_date &&
423
+ metadata == o.metadata
424
+ end
425
+
426
+ # @see the `==` method
427
+ # @param [Object] Object to be compared
428
+ def eql?(o)
429
+ self == o
430
+ end
431
+
432
+ # Calculates hash code according to all attributes.
433
+ # @return [Integer] Hash code
434
+ def hash
435
+ [receipt_id, notice_number, fiscal_code, outcome, creditor_reference_id, payment_amount, description, company_name, office_name, debtor, transfer_list, id_psp, psp_fiscal_code, psp_partita_iva, psp_company_name, id_channel, channel_description, payer, payment_method, fee, primary_ci_incurred_fee, id_bundle, id_ci_bundle, payment_date_time, payment_date_time_formatted, application_date, transfer_date, metadata].hash
436
+ end
437
+
438
+ # Builds the object from hash
439
+ # @param [Hash] attributes Model attributes in the form of hash
440
+ # @return [Object] Returns the model itself
441
+ def self.build_from_hash(attributes)
442
+ return nil unless attributes.is_a?(Hash)
443
+ attributes = attributes.transform_keys(&:to_sym)
444
+ transformed_hash = {}
445
+ openapi_types.each_pair do |key, type|
446
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
447
+ transformed_hash["#{key}"] = nil
448
+ elsif type =~ /\AArray<(.*)>/i
449
+ # check to ensure the input is an array given that the attribute
450
+ # is documented as an array but the input is not
451
+ if attributes[attribute_map[key]].is_a?(Array)
452
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
453
+ end
454
+ elsif !attributes[attribute_map[key]].nil?
455
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
456
+ end
457
+ end
458
+ new(transformed_hash)
459
+ end
460
+
461
+ # Deserializes the data based on type
462
+ # @param string type Data type
463
+ # @param string value Value to be deserialized
464
+ # @return [Object] Deserialized data
465
+ def self._deserialize(type, value)
466
+ case type.to_sym
467
+ when :Time
468
+ Time.parse(value)
469
+ when :Date
470
+ Date.parse(value)
471
+ when :String
472
+ value.to_s
473
+ when :Integer
474
+ value.to_i
475
+ when :Float
476
+ value.to_f
477
+ when :Boolean
478
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
479
+ true
480
+ else
481
+ false
482
+ end
483
+ when :Object
484
+ # generic object (usually a Hash), return directly
485
+ value
486
+ when /\AArray<(?<inner_type>.+)>\z/
487
+ inner_type = Regexp.last_match[:inner_type]
488
+ value.map { |v| _deserialize(inner_type, v) }
489
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
490
+ k_type = Regexp.last_match[:k_type]
491
+ v_type = Regexp.last_match[:v_type]
492
+ {}.tap do |hash|
493
+ value.each do |k, v|
494
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
495
+ end
496
+ end
497
+ else # model
498
+ # models (e.g. Pet) or oneOf
499
+ klass = BizReceipts.const_get(type)
500
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
501
+ end
502
+ end
503
+
504
+ # Returns the string representation of the object
505
+ # @return [String] String presentation of the object
506
+ def to_s
507
+ to_hash.to_s
508
+ end
509
+
510
+ # to_body is an alias to to_hash (backward compatibility)
511
+ # @return [Hash] Returns the object in the form of hash
512
+ def to_body
513
+ to_hash
514
+ end
515
+
516
+ # Returns the object in the form of hash
517
+ # @return [Hash] Returns the object in the form of hash
518
+ def to_hash
519
+ hash = {}
520
+ self.class.attribute_map.each_pair do |attr, param|
521
+ value = self.send(attr)
522
+ if value.nil?
523
+ is_nullable = self.class.openapi_nullable.include?(attr)
524
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
525
+ end
526
+
527
+ hash[param] = _to_hash(value)
528
+ end
529
+ hash
530
+ end
531
+
532
+ # Outputs non-array value in the form of hash
533
+ # For object, use to_hash. Otherwise, just return the value
534
+ # @param [Object] value Any valid value
535
+ # @return [Hash] Returns the value in the form of hash
536
+ def _to_hash(value)
537
+ if value.is_a?(Array)
538
+ value.compact.map { |v| _to_hash(v) }
539
+ elsif value.is_a?(Hash)
540
+ {}.tap do |hash|
541
+ value.each { |k, v| hash[k] = _to_hash(v) }
542
+ end
543
+ elsif value.respond_to? :to_hash
544
+ value.to_hash
545
+ else
546
+ value
547
+ end
548
+ end
549
+
550
+ end
551
+
552
+ end