transferzero-sdk 1.19.5 → 1.21.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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/docs/PayinMethodDetails.md +2 -0
  4. data/docs/PayinMethodDetailsMobile.md +2 -0
  5. data/lib/transferzero-sdk/api_client.rb +2 -30
  6. data/lib/transferzero-sdk/models/payin_method_details.rb +10 -1
  7. data/lib/transferzero-sdk/models/payin_method_details_mobile.rb +10 -1
  8. data/lib/transferzero-sdk/models/payout_method_details_ngn_bank.rb +1 -1
  9. data/lib/transferzero-sdk/models/payout_method_details_xof_mobile.rb +1 -1
  10. data/lib/transferzero-sdk/models/payout_method_mobile_provider_enum.rb +3 -0
  11. data/lib/transferzero-sdk/version.rb +1 -1
  12. data/spec/api/documents_api_spec.rb +0 -15
  13. data/spec/api/payin_methods_api_spec.rb +2 -2
  14. data/spec/api/payout_methods_api_spec.rb +1 -1
  15. data/spec/api/recipients_api_spec.rb +13 -1
  16. data/spec/api/senders_api_spec.rb +1 -1
  17. data/spec/api/transactions_api_spec.rb +1 -0
  18. data/spec/models/account_validation_request_spec.rb +14 -2
  19. data/spec/models/currency_exchange_spec.rb +0 -6
  20. data/spec/models/currency_opposite_spec.rb +4 -4
  21. data/spec/models/currency_spec.rb +0 -6
  22. data/spec/models/document_spec.rb +20 -2
  23. data/spec/models/payin_method_details_mobile_spec.rb +7 -1
  24. data/spec/models/payin_method_details_spec.rb +13 -1
  25. data/spec/models/payin_method_spec.rb +25 -1
  26. data/spec/models/payout_method_details_kes_bank_spec.rb +6 -0
  27. data/spec/models/payout_method_details_kes_mobile_spec.rb +6 -0
  28. data/spec/models/payout_method_details_mobile_spec.rb +6 -0
  29. data/spec/models/payout_method_details_spec.rb +108 -0
  30. data/spec/models/payout_method_details_xof_bank_spec.rb +12 -0
  31. data/spec/models/payout_method_details_xof_cash_spec.rb +3 -9
  32. data/spec/models/payout_method_details_xof_mobile_spec.rb +12 -0
  33. data/spec/models/payout_method_details_zar_bank_spec.rb +48 -0
  34. data/spec/models/recipient_spec.rb +22 -0
  35. data/spec/models/sender_spec.rb +169 -19
  36. data/transferzero-sdk-1.19.5.gem +0 -0
  37. data/transferzero-sdk-1.20.1.gem +0 -0
  38. metadata +4 -30
  39. data/docs/CurrencyExchangeAllOf.md +0 -17
  40. data/docs/CurrencyOppositeAllOf.md +0 -21
  41. data/docs/DocumentWebhookAllOf.md +0 -17
  42. data/docs/PayoutMethodWebhookAllOf.md +0 -17
  43. data/docs/RecipientWebhookAllOf.md +0 -17
  44. data/docs/SenderWebhookAllOf.md +0 -17
  45. data/docs/TransactionWebhookAllOf.md +0 -17
  46. data/lib/transferzero-sdk/models/currency_exchange_all_of.rb +0 -205
  47. data/lib/transferzero-sdk/models/currency_opposite_all_of.rb +0 -223
  48. data/lib/transferzero-sdk/models/document_webhook_all_of.rb +0 -202
  49. data/lib/transferzero-sdk/models/payout_method_webhook_all_of.rb +0 -202
  50. data/lib/transferzero-sdk/models/recipient_webhook_all_of.rb +0 -202
  51. data/lib/transferzero-sdk/models/sender_webhook_all_of.rb +0 -202
  52. data/lib/transferzero-sdk/models/transaction_webhook_all_of.rb +0 -202
  53. data/spec/models/currency_exchange_all_of_spec.rb +0 -41
  54. data/spec/models/currency_opposite_all_of_spec.rb +0 -53
  55. data/spec/models/document_webhook_all_of_spec.rb +0 -41
  56. data/spec/models/payout_method_webhook_all_of_spec.rb +0 -41
  57. data/spec/models/recipient_webhook_all_of_spec.rb +0 -41
  58. data/spec/models/sender_webhook_all_of_spec.rb +0 -41
  59. data/spec/models/transaction_webhook_all_of_spec.rb +0 -41
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transferzero-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.5
4
+ version: 1.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TransferZero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-02 00:00:00.000000000 Z
11
+ date: 2022-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -113,12 +113,10 @@ files:
113
113
  - docs/ApiLogResponse.md
114
114
  - docs/Currency.md
115
115
  - docs/CurrencyExchange.md
116
- - docs/CurrencyExchangeAllOf.md
117
116
  - docs/CurrencyExchangeListResponse.md
118
117
  - docs/CurrencyInfoApi.md
119
118
  - docs/CurrencyListResponse.md
120
119
  - docs/CurrencyOpposite.md
121
- - docs/CurrencyOppositeAllOf.md
122
120
  - docs/Debit.md
123
121
  - docs/DebitListRequest.md
124
122
  - docs/DebitListResponse.md
@@ -130,7 +128,6 @@ files:
130
128
  - docs/DocumentRequest.md
131
129
  - docs/DocumentResponse.md
132
130
  - docs/DocumentWebhook.md
133
- - docs/DocumentWebhookAllOf.md
134
131
  - docs/DocumentsApi.md
135
132
  - docs/ErrorStatus.md
136
133
  - docs/FieldDescription.md
@@ -187,7 +184,6 @@ files:
187
184
  - docs/PayoutMethodResponse.md
188
185
  - docs/PayoutMethodTransferReasonEnum.md
189
186
  - docs/PayoutMethodWebhook.md
190
- - docs/PayoutMethodWebhookAllOf.md
191
187
  - docs/PayoutMethodsApi.md
192
188
  - docs/PoliticallyExposedPerson.md
193
189
  - docs/ProofOfPayment.md
@@ -199,7 +195,6 @@ files:
199
195
  - docs/RecipientState.md
200
196
  - docs/RecipientStateReasonDetails.md
201
197
  - docs/RecipientWebhook.md
202
- - docs/RecipientWebhookAllOf.md
203
198
  - docs/RecipientsApi.md
204
199
  - docs/Sender.md
205
200
  - docs/SenderListResponse.md
@@ -209,7 +204,6 @@ files:
209
204
  - docs/SenderResponseMeta.md
210
205
  - docs/SenderState.md
211
206
  - docs/SenderWebhook.md
212
- - docs/SenderWebhookAllOf.md
213
207
  - docs/SendersApi.md
214
208
  - docs/StateReasonDetails.md
215
209
  - docs/Transaction.md
@@ -221,7 +215,6 @@ files:
221
215
  - docs/TransactionState.md
222
216
  - docs/TransactionTraits.md
223
217
  - docs/TransactionWebhook.md
224
- - docs/TransactionWebhookAllOf.md
225
218
  - docs/TransactionsApi.md
226
219
  - docs/ValidationErrorDescription.md
227
220
  - docs/Webhook.md
@@ -270,11 +263,9 @@ files:
270
263
  - lib/transferzero-sdk/models/api_log_response.rb
271
264
  - lib/transferzero-sdk/models/currency.rb
272
265
  - lib/transferzero-sdk/models/currency_exchange.rb
273
- - lib/transferzero-sdk/models/currency_exchange_all_of.rb
274
266
  - lib/transferzero-sdk/models/currency_exchange_list_response.rb
275
267
  - lib/transferzero-sdk/models/currency_list_response.rb
276
268
  - lib/transferzero-sdk/models/currency_opposite.rb
277
- - lib/transferzero-sdk/models/currency_opposite_all_of.rb
278
269
  - lib/transferzero-sdk/models/debit.rb
279
270
  - lib/transferzero-sdk/models/debit_list_request.rb
280
271
  - lib/transferzero-sdk/models/debit_list_response.rb
@@ -286,7 +277,6 @@ files:
286
277
  - lib/transferzero-sdk/models/document_request.rb
287
278
  - lib/transferzero-sdk/models/document_response.rb
288
279
  - lib/transferzero-sdk/models/document_webhook.rb
289
- - lib/transferzero-sdk/models/document_webhook_all_of.rb
290
280
  - lib/transferzero-sdk/models/error_status.rb
291
281
  - lib/transferzero-sdk/models/field_description.rb
292
282
  - lib/transferzero-sdk/models/field_select_validation.rb
@@ -339,7 +329,6 @@ files:
339
329
  - lib/transferzero-sdk/models/payout_method_response.rb
340
330
  - lib/transferzero-sdk/models/payout_method_transfer_reason_enum.rb
341
331
  - lib/transferzero-sdk/models/payout_method_webhook.rb
342
- - lib/transferzero-sdk/models/payout_method_webhook_all_of.rb
343
332
  - lib/transferzero-sdk/models/politically_exposed_person.rb
344
333
  - lib/transferzero-sdk/models/proof_of_payment.rb
345
334
  - lib/transferzero-sdk/models/proof_of_payment_list_response.rb
@@ -350,7 +339,6 @@ files:
350
339
  - lib/transferzero-sdk/models/recipient_state.rb
351
340
  - lib/transferzero-sdk/models/recipient_state_reason_details.rb
352
341
  - lib/transferzero-sdk/models/recipient_webhook.rb
353
- - lib/transferzero-sdk/models/recipient_webhook_all_of.rb
354
342
  - lib/transferzero-sdk/models/sender.rb
355
343
  - lib/transferzero-sdk/models/sender_list_response.rb
356
344
  - lib/transferzero-sdk/models/sender_request.rb
@@ -359,7 +347,6 @@ files:
359
347
  - lib/transferzero-sdk/models/sender_response_meta.rb
360
348
  - lib/transferzero-sdk/models/sender_state.rb
361
349
  - lib/transferzero-sdk/models/sender_webhook.rb
362
- - lib/transferzero-sdk/models/sender_webhook_all_of.rb
363
350
  - lib/transferzero-sdk/models/state_reason_details.rb
364
351
  - lib/transferzero-sdk/models/transaction.rb
365
352
  - lib/transferzero-sdk/models/transaction_list_response.rb
@@ -370,7 +357,6 @@ files:
370
357
  - lib/transferzero-sdk/models/transaction_state.rb
371
358
  - lib/transferzero-sdk/models/transaction_traits.rb
372
359
  - lib/transferzero-sdk/models/transaction_webhook.rb
373
- - lib/transferzero-sdk/models/transaction_webhook_all_of.rb
374
360
  - lib/transferzero-sdk/models/validation_error_description.rb
375
361
  - lib/transferzero-sdk/models/webhook.rb
376
362
  - lib/transferzero-sdk/models/webhook_definition.rb
@@ -411,11 +397,9 @@ files:
411
397
  - spec/models/api_log_list_response_spec.rb
412
398
  - spec/models/api_log_response_spec.rb
413
399
  - spec/models/api_log_spec.rb
414
- - spec/models/currency_exchange_all_of_spec.rb
415
400
  - spec/models/currency_exchange_list_response_spec.rb
416
401
  - spec/models/currency_exchange_spec.rb
417
402
  - spec/models/currency_list_response_spec.rb
418
- - spec/models/currency_opposite_all_of_spec.rb
419
403
  - spec/models/currency_opposite_spec.rb
420
404
  - spec/models/currency_spec.rb
421
405
  - spec/models/debit_list_request_spec.rb
@@ -428,7 +412,6 @@ files:
428
412
  - spec/models/document_request_spec.rb
429
413
  - spec/models/document_response_spec.rb
430
414
  - spec/models/document_spec.rb
431
- - spec/models/document_webhook_all_of_spec.rb
432
415
  - spec/models/document_webhook_spec.rb
433
416
  - spec/models/error_status_spec.rb
434
417
  - spec/models/field_description_spec.rb
@@ -481,7 +464,6 @@ files:
481
464
  - spec/models/payout_method_response_spec.rb
482
465
  - spec/models/payout_method_spec.rb
483
466
  - spec/models/payout_method_transfer_reason_enum_spec.rb
484
- - spec/models/payout_method_webhook_all_of_spec.rb
485
467
  - spec/models/payout_method_webhook_spec.rb
486
468
  - spec/models/politically_exposed_person_spec.rb
487
469
  - spec/models/proof_of_payment_list_response_spec.rb
@@ -492,7 +474,6 @@ files:
492
474
  - spec/models/recipient_spec.rb
493
475
  - spec/models/recipient_state_reason_details_spec.rb
494
476
  - spec/models/recipient_state_spec.rb
495
- - spec/models/recipient_webhook_all_of_spec.rb
496
477
  - spec/models/recipient_webhook_spec.rb
497
478
  - spec/models/sender_list_response_spec.rb
498
479
  - spec/models/sender_request_spec.rb
@@ -501,7 +482,6 @@ files:
501
482
  - spec/models/sender_response_spec.rb
502
483
  - spec/models/sender_spec.rb
503
484
  - spec/models/sender_state_spec.rb
504
- - spec/models/sender_webhook_all_of_spec.rb
505
485
  - spec/models/sender_webhook_spec.rb
506
486
  - spec/models/state_reason_details_spec.rb
507
487
  - spec/models/transaction_list_response_spec.rb
@@ -512,7 +492,6 @@ files:
512
492
  - spec/models/transaction_spec.rb
513
493
  - spec/models/transaction_state_spec.rb
514
494
  - spec/models/transaction_traits_spec.rb
515
- - spec/models/transaction_webhook_all_of_spec.rb
516
495
  - spec/models/transaction_webhook_spec.rb
517
496
  - spec/models/validation_error_description_spec.rb
518
497
  - spec/models/webhook_definition_event_list_response_spec.rb
@@ -532,6 +511,8 @@ files:
532
511
  - transferzero-sdk-1.19.2.gem
533
512
  - transferzero-sdk-1.19.3.gem
534
513
  - transferzero-sdk-1.19.4.gem
514
+ - transferzero-sdk-1.19.5.gem
515
+ - transferzero-sdk-1.20.1.gem
535
516
  - transferzero-sdk.gemspec
536
517
  homepage: https://github.com/transferzero/transferzero-sdk-ruby
537
518
  licenses:
@@ -585,7 +566,6 @@ test_files:
585
566
  - spec/models/webhook_log_metadata_response_spec.rb
586
567
  - spec/models/currency_list_response_spec.rb
587
568
  - spec/models/debit_response_spec.rb
588
- - spec/models/currency_opposite_all_of_spec.rb
589
569
  - spec/models/webhook_definition_event_list_response_spec.rb
590
570
  - spec/models/debit_spec.rb
591
571
  - spec/models/payin_method_details_btc_spec.rb
@@ -595,19 +575,16 @@ test_files:
595
575
  - spec/models/webhook_definition_request_spec.rb
596
576
  - spec/models/sender_state_spec.rb
597
577
  - spec/models/payout_method_request_spec.rb
598
- - spec/models/document_webhook_all_of_spec.rb
599
578
  - spec/models/payout_method_details_kes_mobile_spec.rb
600
579
  - spec/models/payout_method_details_gbp_bank_spec.rb
601
580
  - spec/models/webhook_log_metadata_request_spec.rb
602
581
  - spec/models/recipient_webhook_spec.rb
603
- - spec/models/recipient_webhook_all_of_spec.rb
604
582
  - spec/models/api_log_list_response_spec.rb
605
583
  - spec/models/debit_list_response_spec.rb
606
584
  - spec/models/pagination_meta_spec.rb
607
585
  - spec/models/account_validation_result_spec.rb
608
586
  - spec/models/debit_request_wrapper_spec.rb
609
587
  - spec/models/document_webhook_spec.rb
610
- - spec/models/transaction_webhook_all_of_spec.rb
611
588
  - spec/models/payout_method_details_zar_bank_spec.rb
612
589
  - spec/models/payout_method_gender_enum_spec.rb
613
590
  - spec/models/payout_method_legal_entity_type_enum_spec.rb
@@ -615,7 +592,6 @@ test_files:
615
592
  - spec/models/payin_method_spec.rb
616
593
  - spec/models/sender_response_spec.rb
617
594
  - spec/models/payin_method_details_mobile_spec.rb
618
- - spec/models/currency_exchange_all_of_spec.rb
619
595
  - spec/models/payout_method_details_mad_cash_spec.rb
620
596
  - spec/models/account_validation_response_spec.rb
621
597
  - spec/models/payout_method_details_btc_spec.rb
@@ -629,7 +605,6 @@ test_files:
629
605
  - spec/models/transaction_webhook_spec.rb
630
606
  - spec/models/payout_method_details_xof_bank_spec.rb
631
607
  - spec/models/webhook_log_metadata_spec.rb
632
- - spec/models/sender_webhook_all_of_spec.rb
633
608
  - spec/models/account_list_response_spec.rb
634
609
  - spec/models/document_list_response_spec.rb
635
610
  - spec/models/transaction_spec.rb
@@ -663,7 +638,6 @@ test_files:
663
638
  - spec/models/account_response_spec.rb
664
639
  - spec/models/recipient_request_spec.rb
665
640
  - spec/models/recipient_state_reason_details_spec.rb
666
- - spec/models/payout_method_webhook_all_of_spec.rb
667
641
  - spec/models/payout_method_webhook_spec.rb
668
642
  - spec/models/sender_response_meta_spec.rb
669
643
  - spec/models/payout_method_nature_of_business_enum_spec.rb
@@ -1,17 +0,0 @@
1
- # TransferZero::CurrencyExchangeAllOf
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **opposites** | [**Array<CurrencyOpposite>**](CurrencyOpposite.md) | Lists the currencies where you can exchange from this one | [optional]
8
-
9
- ## Code Sample
10
-
11
- ```ruby
12
- require 'TransferZero'
13
-
14
- instance = TransferZero::CurrencyExchangeAllOf.new(opposites: null)
15
- ```
16
-
17
-
@@ -1,21 +0,0 @@
1
- # TransferZero::CurrencyOppositeAllOf
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **rate** | **Float** | The rate of this particular currency with the base one | [optional]
8
- **mtm_rate** | **Float** | Mark to market rate of this particular currency against the base one with the margin factored in | [optional]
9
- **margin** | **String** | The margin set for transactions of this particular currency with the base one | [optional]
10
-
11
- ## Code Sample
12
-
13
- ```ruby
14
- require 'TransferZero'
15
-
16
- instance = TransferZero::CurrencyOppositeAllOf.new(rate: null,
17
- mtm_rate: null,
18
- margin: null)
19
- ```
20
-
21
-
@@ -1,17 +0,0 @@
1
- # TransferZero::DocumentWebhookAllOf
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **object** | [**Document**](Document.md) | | [optional]
8
-
9
- ## Code Sample
10
-
11
- ```ruby
12
- require 'TransferZero'
13
-
14
- instance = TransferZero::DocumentWebhookAllOf.new(object: null)
15
- ```
16
-
17
-
@@ -1,17 +0,0 @@
1
- # TransferZero::PayoutMethodWebhookAllOf
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **object** | [**PayoutMethod**](PayoutMethod.md) | | [optional]
8
-
9
- ## Code Sample
10
-
11
- ```ruby
12
- require 'TransferZero'
13
-
14
- instance = TransferZero::PayoutMethodWebhookAllOf.new(object: null)
15
- ```
16
-
17
-
@@ -1,17 +0,0 @@
1
- # TransferZero::RecipientWebhookAllOf
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **object** | [**Recipient**](Recipient.md) | | [optional]
8
-
9
- ## Code Sample
10
-
11
- ```ruby
12
- require 'TransferZero'
13
-
14
- instance = TransferZero::RecipientWebhookAllOf.new(object: null)
15
- ```
16
-
17
-
@@ -1,17 +0,0 @@
1
- # TransferZero::SenderWebhookAllOf
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **object** | [**Sender**](Sender.md) | | [optional]
8
-
9
- ## Code Sample
10
-
11
- ```ruby
12
- require 'TransferZero'
13
-
14
- instance = TransferZero::SenderWebhookAllOf.new(object: null)
15
- ```
16
-
17
-
@@ -1,17 +0,0 @@
1
- # TransferZero::TransactionWebhookAllOf
2
-
3
- ## Properties
4
-
5
- Name | Type | Description | Notes
6
- ------------ | ------------- | ------------- | -------------
7
- **object** | [**Transaction**](Transaction.md) | | [optional]
8
-
9
- ## Code Sample
10
-
11
- ```ruby
12
- require 'TransferZero'
13
-
14
- instance = TransferZero::TransactionWebhookAllOf.new(object: null)
15
- ```
16
-
17
-
@@ -1,205 +0,0 @@
1
- =begin
2
- #TransferZero API
3
-
4
- #Reference documentation for the TransferZero API V1
5
-
6
- The version of the OpenAPI document: 1.0
7
-
8
- Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.1.1
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module TransferZero
16
- class CurrencyExchangeAllOf
17
- # Lists the currencies where you can exchange from this one
18
- attr_accessor :opposites
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'opposites' => :'opposites'
24
- }
25
- end
26
-
27
- # Attribute type mapping.
28
- def self.openapi_types
29
- {
30
- :'opposites' => :'Array<CurrencyOpposite>'
31
- }
32
- end
33
-
34
- # Initializes the object
35
- # @param [Hash] attributes Model attributes in the form of hash
36
- def initialize(attributes = {})
37
- if (!attributes.is_a?(Hash))
38
- fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::CurrencyExchangeAllOf` initialize method"
39
- end
40
-
41
- # check to see if the attribute exists and convert string to symbol for hash key
42
- attributes = attributes.each_with_object({}) { |(k, v), h|
43
- if (!self.class.attribute_map.key?(k.to_sym))
44
- fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::CurrencyExchangeAllOf`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
45
- end
46
- h[k.to_sym] = v
47
- }
48
-
49
- if attributes.key?(:'opposites')
50
- if (value = attributes[:'opposites']).is_a?(Array)
51
- self.opposites = value
52
- end
53
- end
54
- end
55
-
56
- # Show invalid properties with the reasons. Usually used together with valid?
57
- # @return Array for valid properties with the reasons
58
- def list_invalid_properties
59
- invalid_properties = Array.new
60
- invalid_properties
61
- end
62
-
63
- # Check to see if the all the properties in the model are valid
64
- # @return true if the model is valid
65
- def valid?
66
- true
67
- end
68
-
69
- # Checks equality by comparing each attribute.
70
- # @param [Object] Object to be compared
71
- def ==(o)
72
- return true if self.equal?(o)
73
- self.class == o.class &&
74
- opposites == o.opposites
75
- end
76
-
77
- # @see the `==` method
78
- # @param [Object] Object to be compared
79
- def eql?(o)
80
- self == o
81
- end
82
-
83
- # Calculates hash code according to all attributes.
84
- # @return [Integer] Hash code
85
- def hash
86
- [opposites].hash
87
- end
88
-
89
- require 'active_support/core_ext/hash'
90
- require 'active_support/hash_with_indifferent_access.rb'
91
- # Builds the object from hash
92
- # @param [Hash] attributes Model attributes in the form of hash
93
- # @return [Object] Returns the model itself
94
- def build_from_hash(attributes)
95
- return nil unless attributes.is_a?(Hash)
96
- self.class.openapi_types.each_pair do |key, type|
97
- if type =~ /\AArray<(.*)>/i
98
- # check to ensure the input is an array given that the the attribute
99
- # is documented as an array but the input is not
100
- if attributes[self.class.attribute_map[key]].is_a?(Array)
101
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
102
- end
103
- elsif !attributes[self.class.attribute_map[key]].nil?
104
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
- end # or else data not found in attributes(hash), not an issue as the data can be optional
106
- end
107
-
108
- self
109
- end
110
-
111
- # Deserializes the data based on type
112
- # @param string type Data type
113
- # @param string value Value to be deserialized
114
- # @return [Object] Deserialized data
115
- def _deserialize(type, value)
116
- case type.to_sym
117
- when :DateTime
118
- DateTime.parse(value)
119
- when :Date
120
- Date.parse(value)
121
- when :String
122
- value.to_s
123
- when :Integer
124
- value.to_i
125
- when :Float
126
- value.to_f
127
- when :Boolean
128
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
129
- true
130
- else
131
- false
132
- end
133
- when :Object
134
- # generic object (usually a Hash), return directly
135
- value
136
- when /\AArray<(?<inner_type>.+)>\z/
137
- inner_type = Regexp.last_match[:inner_type]
138
- value.map { |v| _deserialize(inner_type, v) }
139
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
140
- k_type = Regexp.last_match[:k_type]
141
- v_type = Regexp.last_match[:v_type]
142
- {}.tap do |hash|
143
- value.each do |k, v|
144
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
- end
146
- end
147
- else # model
148
- temp_model = TransferZero.const_get(type).new
149
- temp_model.build_from_hash(value)
150
- end
151
- end
152
-
153
- # Returns the string representation of the object
154
- # @return [String] String presentation of the object
155
- def to_s
156
- to_hash.to_s
157
- end
158
-
159
- # to_body is an alias to to_hash (backward compatibility)
160
- # @return [Hash] Returns the object in the form of hash
161
- def to_body
162
- to_hash
163
- end
164
-
165
- # Returns the object in the form of hash
166
- # @return [Hash] Returns the object in the form of hash
167
- def to_hash
168
- hash = {}
169
- self.class.attribute_map.each_pair do |attr, param|
170
- value = self.send(attr)
171
- next if value.nil?
172
- hash[param] = _to_hash(value)
173
- end
174
- ::ActiveSupport::HashWithIndifferentAccess.new(hash)
175
- end
176
-
177
- def [](key)
178
- to_hash[key]
179
- end
180
-
181
- def dig(*args)
182
- to_hash.dig(*args)
183
- end
184
-
185
- # Outputs non-array value in the form of hash
186
- # For object, use to_hash. Otherwise, just return the value
187
- # @param [Object] value Any valid value
188
- # @return [Hash] Returns the value in the form of hash
189
- def _to_hash(value)
190
- if value.is_a?(Array)
191
- value.compact.map { |v| _to_hash(v) }
192
- elsif value.is_a?(Hash)
193
- {}.tap do |hash|
194
- value.each { |k, v| hash[k] = _to_hash(v) }
195
- end
196
- elsif value.respond_to? :to_hash
197
- value.to_hash
198
- else
199
- value
200
- end
201
- end
202
-
203
- end
204
-
205
- end