transferzero-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/LICENSE +7 -0
- data/README.md +286 -0
- data/Rakefile +10 -0
- data/docs/APILogsApi.md +141 -0
- data/docs/Account.md +19 -0
- data/docs/AccountDebitsApi.md +199 -0
- data/docs/AccountListResponse.md +19 -0
- data/docs/AccountMeta.md +17 -0
- data/docs/AccountResponse.md +19 -0
- data/docs/AccountValidationApi.md +70 -0
- data/docs/AccountValidationError.md +17 -0
- data/docs/AccountValidationRequest.md +25 -0
- data/docs/AccountValidationResponse.md +19 -0
- data/docs/AccountValidationResult.md +17 -0
- data/docs/AccountsApi.md +128 -0
- data/docs/ApiLog.md +33 -0
- data/docs/ApiLogListResponse.md +19 -0
- data/docs/ApiLogResponse.md +17 -0
- data/docs/Currency.md +35 -0
- data/docs/CurrencyExchange.md +37 -0
- data/docs/CurrencyExchangeListResponse.md +17 -0
- data/docs/CurrencyInfoApi.md +182 -0
- data/docs/CurrencyListResponse.md +17 -0
- data/docs/CurrencyOpposite.md +37 -0
- data/docs/Debit.md +35 -0
- data/docs/DebitListRequest.md +17 -0
- data/docs/DebitListResponse.md +19 -0
- data/docs/DebitRequest.md +17 -0
- data/docs/DebitRequestWrapper.md +17 -0
- data/docs/DebitResponse.md +17 -0
- data/docs/Document.md +35 -0
- data/docs/DocumentListResponse.md +19 -0
- data/docs/DocumentRequest.md +17 -0
- data/docs/DocumentResponse.md +17 -0
- data/docs/DocumentWebhook.md +21 -0
- data/docs/DocumentsApi.md +199 -0
- data/docs/ErrorStatus.md +19 -0
- data/docs/FieldDescription.md +19 -0
- data/docs/FieldSelectValidation.md +19 -0
- data/docs/FieldValidation.md +21 -0
- data/docs/LogsApi.md +141 -0
- data/docs/Pagination.md +25 -0
- data/docs/PaginationMeta.md +17 -0
- data/docs/PayinMethod.md +25 -0
- data/docs/PayinMethodDetails.md +21 -0
- data/docs/PayinMethodDetailsMobile.md +19 -0
- data/docs/PayinMethodDetailsNGNBank.md +17 -0
- data/docs/PayinMethodRequest.md +17 -0
- data/docs/PaymentMethod.md +27 -0
- data/docs/PaymentMethodListResponse.md +17 -0
- data/docs/PaymentMethodOpposite.md +29 -0
- data/docs/PaymentMethodsApi.md +124 -0
- data/docs/PayoutMethod.md +27 -0
- data/docs/PayoutMethodBankAccountTypeEnum.md +16 -0
- data/docs/PayoutMethodDetails.md +53 -0
- data/docs/PayoutMethodDetailsBalance.md +17 -0
- data/docs/PayoutMethodDetailsGHSBank.md +23 -0
- data/docs/PayoutMethodDetailsIBAN.md +25 -0
- data/docs/PayoutMethodDetailsMADCash.md +37 -0
- data/docs/PayoutMethodDetailsMobile.md +21 -0
- data/docs/PayoutMethodDetailsNGNBank.md +25 -0
- data/docs/PayoutMethodDetailsXOFMobile.md +23 -0
- data/docs/PayoutMethodGenderEnum.md +16 -0
- data/docs/PayoutMethodIdentityCardTypeEnum.md +16 -0
- data/docs/PayoutMethodListResponse.md +19 -0
- data/docs/PayoutMethodMobileProviderEnum.md +16 -0
- data/docs/PayoutMethodRequest.md +17 -0
- data/docs/PayoutMethodResponse.md +17 -0
- data/docs/PayoutMethodWebhook.md +21 -0
- data/docs/PayoutMethodsApi.md +334 -0
- data/docs/Recipient.md +55 -0
- data/docs/RecipientListResponse.md +19 -0
- data/docs/RecipientRequest.md +17 -0
- data/docs/RecipientResponse.md +17 -0
- data/docs/RecipientState.md +16 -0
- data/docs/RecipientWebhook.md +21 -0
- data/docs/RecipientsApi.md +212 -0
- data/docs/Sender.md +67 -0
- data/docs/SenderListResponse.md +19 -0
- data/docs/SenderRequest.md +17 -0
- data/docs/SenderResponse.md +19 -0
- data/docs/SenderResponseExisting.md +17 -0
- data/docs/SenderResponseMeta.md +17 -0
- data/docs/SenderState.md +16 -0
- data/docs/SenderWebhook.md +21 -0
- data/docs/SendersApi.md +330 -0
- data/docs/Transaction.md +47 -0
- data/docs/TransactionListResponse.md +19 -0
- data/docs/TransactionRequest.md +17 -0
- data/docs/TransactionResponse.md +19 -0
- data/docs/TransactionResponseExisting.md +19 -0
- data/docs/TransactionResponseMeta.md +17 -0
- data/docs/TransactionState.md +16 -0
- data/docs/TransactionTraits.md +19 -0
- data/docs/TransactionWebhook.md +21 -0
- data/docs/TransactionsApi.md +450 -0
- data/docs/ValidationErrorDescription.md +17 -0
- data/docs/Webhook.md +21 -0
- data/docs/WebhookDefinition.md +25 -0
- data/docs/WebhookDefinitionEventListResponse.md +17 -0
- data/docs/WebhookDefinitionListResponse.md +19 -0
- data/docs/WebhookDefinitionRequest.md +17 -0
- data/docs/WebhookDefinitionResponse.md +17 -0
- data/docs/WebhookLog.md +27 -0
- data/docs/WebhookLogListResponse.md +19 -0
- data/docs/WebhookLogMetadata.md +35 -0
- data/docs/WebhookLogMetadataRequest.md +21 -0
- data/docs/WebhookLogMetadataResponse.md +21 -0
- data/docs/WebhookLogResponse.md +17 -0
- data/docs/WebhooksApi.md +319 -0
- data/example/client.rb +473 -0
- data/git_push.sh +55 -0
- data/lib/transferzero-sdk.rb +146 -0
- data/lib/transferzero-sdk/api/account_debits_api.rb +187 -0
- data/lib/transferzero-sdk/api/account_validation_api.rb +79 -0
- data/lib/transferzero-sdk/api/accounts_api.rb +135 -0
- data/lib/transferzero-sdk/api/api_logs_api.rb +137 -0
- data/lib/transferzero-sdk/api/currency_info_api.rb +167 -0
- data/lib/transferzero-sdk/api/documents_api.rb +197 -0
- data/lib/transferzero-sdk/api/logs_api.rb +137 -0
- data/lib/transferzero-sdk/api/payment_methods_api.rb +119 -0
- data/lib/transferzero-sdk/api/payout_methods_api.rb +321 -0
- data/lib/transferzero-sdk/api/recipients_api.rb +221 -0
- data/lib/transferzero-sdk/api/senders_api.rb +322 -0
- data/lib/transferzero-sdk/api/transactions_api.rb +428 -0
- data/lib/transferzero-sdk/api/webhooks_api.rb +299 -0
- data/lib/transferzero-sdk/api_client.rb +455 -0
- data/lib/transferzero-sdk/api_error.rb +61 -0
- data/lib/transferzero-sdk/configuration.rb +166 -0
- data/lib/transferzero-sdk/models/account.rb +212 -0
- data/lib/transferzero-sdk/models/account_list_response.rb +212 -0
- data/lib/transferzero-sdk/models/account_meta.rb +202 -0
- data/lib/transferzero-sdk/models/account_response.rb +210 -0
- data/lib/transferzero-sdk/models/account_validation_error.rb +202 -0
- data/lib/transferzero-sdk/models/account_validation_request.rb +325 -0
- data/lib/transferzero-sdk/models/account_validation_response.rb +210 -0
- data/lib/transferzero-sdk/models/account_validation_result.rb +202 -0
- data/lib/transferzero-sdk/models/api_log.rb +287 -0
- data/lib/transferzero-sdk/models/api_log_list_response.rb +213 -0
- data/lib/transferzero-sdk/models/api_log_response.rb +201 -0
- data/lib/transferzero-sdk/models/currency.rb +292 -0
- data/lib/transferzero-sdk/models/currency_exchange.rb +311 -0
- data/lib/transferzero-sdk/models/currency_exchange_list_response.rb +204 -0
- data/lib/transferzero-sdk/models/currency_list_response.rb +204 -0
- data/lib/transferzero-sdk/models/currency_opposite.rb +309 -0
- data/lib/transferzero-sdk/models/debit.rb +309 -0
- data/lib/transferzero-sdk/models/debit_list_request.rb +203 -0
- data/lib/transferzero-sdk/models/debit_list_response.rb +212 -0
- data/lib/transferzero-sdk/models/debit_request.rb +201 -0
- data/lib/transferzero-sdk/models/debit_request_wrapper.rb +227 -0
- data/lib/transferzero-sdk/models/debit_response.rb +201 -0
- data/lib/transferzero-sdk/models/document.rb +335 -0
- data/lib/transferzero-sdk/models/document_list_response.rb +212 -0
- data/lib/transferzero-sdk/models/document_request.rb +201 -0
- data/lib/transferzero-sdk/models/document_response.rb +201 -0
- data/lib/transferzero-sdk/models/document_webhook.rb +243 -0
- data/lib/transferzero-sdk/models/error_status.rb +210 -0
- data/lib/transferzero-sdk/models/field_description.rb +245 -0
- data/lib/transferzero-sdk/models/field_select_validation.rb +212 -0
- data/lib/transferzero-sdk/models/field_validation.rb +221 -0
- data/lib/transferzero-sdk/models/pagination.rb +242 -0
- data/lib/transferzero-sdk/models/pagination_meta.rb +201 -0
- data/lib/transferzero-sdk/models/payin_method.rb +242 -0
- data/lib/transferzero-sdk/models/payin_method_details.rb +257 -0
- data/lib/transferzero-sdk/models/payin_method_details_mobile.rb +218 -0
- data/lib/transferzero-sdk/models/payin_method_details_ngn_bank.rb +208 -0
- data/lib/transferzero-sdk/models/payin_method_request.rb +201 -0
- data/lib/transferzero-sdk/models/payment_method.rb +257 -0
- data/lib/transferzero-sdk/models/payment_method_list_response.rb +203 -0
- data/lib/transferzero-sdk/models/payment_method_opposite.rb +275 -0
- data/lib/transferzero-sdk/models/payout_method.rb +255 -0
- data/lib/transferzero-sdk/models/payout_method_bank_account_type_enum.rb +36 -0
- data/lib/transferzero-sdk/models/payout_method_details.rb +462 -0
- data/lib/transferzero-sdk/models/payout_method_details_balance.rb +202 -0
- data/lib/transferzero-sdk/models/payout_method_details_ghs_bank.rb +249 -0
- data/lib/transferzero-sdk/models/payout_method_details_iban.rb +258 -0
- data/lib/transferzero-sdk/models/payout_method_details_mad_cash.rb +332 -0
- data/lib/transferzero-sdk/models/payout_method_details_mobile.rb +235 -0
- data/lib/transferzero-sdk/models/payout_method_details_ngn_bank.rb +263 -0
- data/lib/transferzero-sdk/models/payout_method_details_xof_mobile.rb +249 -0
- data/lib/transferzero-sdk/models/payout_method_gender_enum.rb +36 -0
- data/lib/transferzero-sdk/models/payout_method_identity_card_type_enum.rb +37 -0
- data/lib/transferzero-sdk/models/payout_method_list_response.rb +212 -0
- data/lib/transferzero-sdk/models/payout_method_mobile_provider_enum.rb +36 -0
- data/lib/transferzero-sdk/models/payout_method_request.rb +201 -0
- data/lib/transferzero-sdk/models/payout_method_response.rb +201 -0
- data/lib/transferzero-sdk/models/payout_method_webhook.rb +243 -0
- data/lib/transferzero-sdk/models/recipient.rb +406 -0
- data/lib/transferzero-sdk/models/recipient_list_response.rb +212 -0
- data/lib/transferzero-sdk/models/recipient_request.rb +201 -0
- data/lib/transferzero-sdk/models/recipient_response.rb +201 -0
- data/lib/transferzero-sdk/models/recipient_state.rb +44 -0
- data/lib/transferzero-sdk/models/recipient_webhook.rb +243 -0
- data/lib/transferzero-sdk/models/sender.rb +529 -0
- data/lib/transferzero-sdk/models/sender_list_response.rb +212 -0
- data/lib/transferzero-sdk/models/sender_request.rb +201 -0
- data/lib/transferzero-sdk/models/sender_response.rb +210 -0
- data/lib/transferzero-sdk/models/sender_response_existing.rb +201 -0
- data/lib/transferzero-sdk/models/sender_response_meta.rb +201 -0
- data/lib/transferzero-sdk/models/sender_state.rb +40 -0
- data/lib/transferzero-sdk/models/sender_webhook.rb +243 -0
- data/lib/transferzero-sdk/models/transaction.rb +370 -0
- data/lib/transferzero-sdk/models/transaction_list_response.rb +212 -0
- data/lib/transferzero-sdk/models/transaction_request.rb +201 -0
- data/lib/transferzero-sdk/models/transaction_response.rb +210 -0
- data/lib/transferzero-sdk/models/transaction_response_existing.rb +210 -0
- data/lib/transferzero-sdk/models/transaction_response_meta.rb +201 -0
- data/lib/transferzero-sdk/models/transaction_state.rb +44 -0
- data/lib/transferzero-sdk/models/transaction_traits.rb +213 -0
- data/lib/transferzero-sdk/models/transaction_webhook.rb +243 -0
- data/lib/transferzero-sdk/models/validation_error_description.rb +203 -0
- data/lib/transferzero-sdk/models/webhook.rb +238 -0
- data/lib/transferzero-sdk/models/webhook_definition.rb +256 -0
- data/lib/transferzero-sdk/models/webhook_definition_event_list_response.rb +203 -0
- data/lib/transferzero-sdk/models/webhook_definition_list_response.rb +212 -0
- data/lib/transferzero-sdk/models/webhook_definition_request.rb +201 -0
- data/lib/transferzero-sdk/models/webhook_definition_response.rb +201 -0
- data/lib/transferzero-sdk/models/webhook_log.rb +249 -0
- data/lib/transferzero-sdk/models/webhook_log_list_response.rb +213 -0
- data/lib/transferzero-sdk/models/webhook_log_metadata.rb +289 -0
- data/lib/transferzero-sdk/models/webhook_log_metadata_request.rb +224 -0
- data/lib/transferzero-sdk/models/webhook_log_metadata_response.rb +225 -0
- data/lib/transferzero-sdk/models/webhook_log_response.rb +201 -0
- data/lib/transferzero-sdk/version.rb +15 -0
- data/spec/api/account_debits_api_spec.rb +72 -0
- data/spec/api/account_validation_api_spec.rb +47 -0
- data/spec/api/accounts_api_spec.rb +58 -0
- data/spec/api/api_logs_api_spec.rb +62 -0
- data/spec/api/currency_info_api_spec.rb +68 -0
- data/spec/api/documents_api_spec.rb +72 -0
- data/spec/api/logs_api_spec.rb +62 -0
- data/spec/api/payment_methods_api_spec.rb +57 -0
- data/spec/api/payout_methods_api_spec.rb +102 -0
- data/spec/api/recipients_api_spec.rb +79 -0
- data/spec/api/senders_api_spec.rb +100 -0
- data/spec/api/transactions_api_spec.rb +122 -0
- data/spec/api/webhooks_api_spec.rb +95 -0
- data/spec/api_client_spec.rb +189 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/account_list_response_spec.rb +47 -0
- data/spec/models/account_meta_spec.rb +41 -0
- data/spec/models/account_response_spec.rb +47 -0
- data/spec/models/account_spec.rb +47 -0
- data/spec/models/account_validation_error_spec.rb +41 -0
- data/spec/models/account_validation_request_spec.rb +77 -0
- data/spec/models/account_validation_response_spec.rb +47 -0
- data/spec/models/account_validation_result_spec.rb +41 -0
- data/spec/models/api_log_list_response_spec.rb +47 -0
- data/spec/models/api_log_response_spec.rb +41 -0
- data/spec/models/api_log_spec.rb +89 -0
- data/spec/models/currency_exchange_list_response_spec.rb +41 -0
- data/spec/models/currency_exchange_spec.rb +101 -0
- data/spec/models/currency_list_response_spec.rb +41 -0
- data/spec/models/currency_opposite_spec.rb +101 -0
- data/spec/models/currency_spec.rb +95 -0
- data/spec/models/debit_list_request_spec.rb +41 -0
- data/spec/models/debit_list_response_spec.rb +47 -0
- data/spec/models/debit_request_spec.rb +41 -0
- data/spec/models/debit_request_wrapper_spec.rb +41 -0
- data/spec/models/debit_response_spec.rb +41 -0
- data/spec/models/debit_spec.rb +95 -0
- data/spec/models/document_list_response_spec.rb +47 -0
- data/spec/models/document_request_spec.rb +41 -0
- data/spec/models/document_response_spec.rb +41 -0
- data/spec/models/document_spec.rb +99 -0
- data/spec/models/document_webhook_spec.rb +53 -0
- data/spec/models/error_status_spec.rb +47 -0
- data/spec/models/field_description_spec.rb +51 -0
- data/spec/models/field_select_validation_spec.rb +47 -0
- data/spec/models/field_validation_spec.rb +53 -0
- data/spec/models/pagination_meta_spec.rb +41 -0
- data/spec/models/pagination_spec.rb +65 -0
- data/spec/models/payin_method_details_mobile_spec.rb +47 -0
- data/spec/models/payin_method_details_ngn_bank_spec.rb +41 -0
- data/spec/models/payin_method_details_spec.rb +53 -0
- data/spec/models/payin_method_request_spec.rb +41 -0
- data/spec/models/payin_method_spec.rb +65 -0
- data/spec/models/payment_method_list_response_spec.rb +41 -0
- data/spec/models/payment_method_opposite_spec.rb +77 -0
- data/spec/models/payment_method_spec.rb +71 -0
- data/spec/models/payout_method_bank_account_type_enum_spec.rb +35 -0
- data/spec/models/payout_method_details_balance_spec.rb +41 -0
- data/spec/models/payout_method_details_ghs_bank_spec.rb +59 -0
- data/spec/models/payout_method_details_iban_spec.rb +65 -0
- data/spec/models/payout_method_details_mad_cash_spec.rb +101 -0
- data/spec/models/payout_method_details_mobile_spec.rb +53 -0
- data/spec/models/payout_method_details_ngn_bank_spec.rb +65 -0
- data/spec/models/payout_method_details_spec.rb +149 -0
- data/spec/models/payout_method_details_xof_mobile_spec.rb +59 -0
- data/spec/models/payout_method_gender_enum_spec.rb +35 -0
- data/spec/models/payout_method_identity_card_type_enum_spec.rb +35 -0
- data/spec/models/payout_method_list_response_spec.rb +47 -0
- data/spec/models/payout_method_mobile_provider_enum_spec.rb +35 -0
- data/spec/models/payout_method_request_spec.rb +41 -0
- data/spec/models/payout_method_response_spec.rb +41 -0
- data/spec/models/payout_method_spec.rb +71 -0
- data/spec/models/payout_method_webhook_spec.rb +53 -0
- data/spec/models/recipient_list_response_spec.rb +47 -0
- data/spec/models/recipient_request_spec.rb +41 -0
- data/spec/models/recipient_response_spec.rb +41 -0
- data/spec/models/recipient_spec.rb +155 -0
- data/spec/models/recipient_state_spec.rb +35 -0
- data/spec/models/recipient_webhook_spec.rb +53 -0
- data/spec/models/sender_list_response_spec.rb +47 -0
- data/spec/models/sender_request_spec.rb +41 -0
- data/spec/models/sender_response_existing_spec.rb +41 -0
- data/spec/models/sender_response_meta_spec.rb +41 -0
- data/spec/models/sender_response_spec.rb +47 -0
- data/spec/models/sender_spec.rb +195 -0
- data/spec/models/sender_state_spec.rb +35 -0
- data/spec/models/sender_webhook_spec.rb +53 -0
- data/spec/models/transaction_list_response_spec.rb +47 -0
- data/spec/models/transaction_request_spec.rb +41 -0
- data/spec/models/transaction_response_existing_spec.rb +47 -0
- data/spec/models/transaction_response_meta_spec.rb +41 -0
- data/spec/models/transaction_response_spec.rb +47 -0
- data/spec/models/transaction_spec.rb +131 -0
- data/spec/models/transaction_state_spec.rb +35 -0
- data/spec/models/transaction_traits_spec.rb +47 -0
- data/spec/models/transaction_webhook_spec.rb +53 -0
- data/spec/models/validation_error_description_spec.rb +41 -0
- data/spec/models/webhook_definition_event_list_response_spec.rb +41 -0
- data/spec/models/webhook_definition_list_response_spec.rb +47 -0
- data/spec/models/webhook_definition_request_spec.rb +41 -0
- data/spec/models/webhook_definition_response_spec.rb +41 -0
- data/spec/models/webhook_definition_spec.rb +65 -0
- data/spec/models/webhook_log_list_response_spec.rb +47 -0
- data/spec/models/webhook_log_metadata_request_spec.rb +53 -0
- data/spec/models/webhook_log_metadata_response_spec.rb +53 -0
- data/spec/models/webhook_log_metadata_spec.rb +95 -0
- data/spec/models/webhook_log_response_spec.rb +41 -0
- data/spec/models/webhook_log_spec.rb +71 -0
- data/spec/models/webhook_spec.rb +53 -0
- data/spec/spec_helper.rb +111 -0
- data/transferzero-sdk.gemspec +46 -0
- metadata +684 -0
@@ -0,0 +1,406 @@
|
|
1
|
+
=begin
|
2
|
+
#TransferZero API
|
3
|
+
|
4
|
+
#Reference documentation for the TransferZero API V1
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.0-beta3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module TransferZero
|
16
|
+
# The recipient describes the amount, the currency and the destination where the money should be sent.
|
17
|
+
class Recipient
|
18
|
+
# the amount that should be paid to the recipient. This can be in any currency, usually either the input or the output currency. If the value here is not the output currency we will calculate how much the recipient is going to get using the exchange rates active when the transaction was created.
|
19
|
+
attr_accessor :requested_amount
|
20
|
+
|
21
|
+
# the currency of the amount in 3-character alpha ISO 4217 currency format
|
22
|
+
attr_accessor :requested_currency
|
23
|
+
|
24
|
+
attr_accessor :payout_method
|
25
|
+
|
26
|
+
# Additional metadata that can be added to a recipient. These values will be returned on request
|
27
|
+
attr_accessor :metadata
|
28
|
+
|
29
|
+
# Date and time that the recipient was created.
|
30
|
+
attr_accessor :created_at
|
31
|
+
|
32
|
+
# Shows whether the recipient can be edited using the PATCH /v1/recipients/{id} endpoint or not
|
33
|
+
attr_accessor :editable
|
34
|
+
|
35
|
+
# Shows how much this payment is worth in USD
|
36
|
+
attr_accessor :input_usd_amount
|
37
|
+
|
38
|
+
# Shows whether the payment can be cancelled using the DELETE /v1/recipients/{id} endpoint or not. The payment can not be cancelled if the payout is pending.
|
39
|
+
attr_accessor :may_cancel
|
40
|
+
|
41
|
+
# In case the payment is unsuccessful it holds the error message associated with the last unsuccessful payout.
|
42
|
+
attr_accessor :state_reason
|
43
|
+
|
44
|
+
attr_accessor :state
|
45
|
+
|
46
|
+
# The ID of the transaction that is related to this recipient
|
47
|
+
attr_accessor :transaction_id
|
48
|
+
|
49
|
+
attr_accessor :transaction_state
|
50
|
+
|
51
|
+
# The exchange rate used in this payment
|
52
|
+
attr_accessor :exchange_rate
|
53
|
+
|
54
|
+
# The fee for this payment in fractional units (for example cents for USD transactions)
|
55
|
+
attr_accessor :fee_fractional
|
56
|
+
|
57
|
+
# The amount that had to be paid in for this payment to proceed
|
58
|
+
attr_accessor :input_amount
|
59
|
+
|
60
|
+
# The currency this payment was paid in
|
61
|
+
attr_accessor :input_currency
|
62
|
+
|
63
|
+
# The amount that will be paid to the recipient
|
64
|
+
attr_accessor :output_amount
|
65
|
+
|
66
|
+
# The currency the payment will be delivered in
|
67
|
+
attr_accessor :output_currency
|
68
|
+
|
69
|
+
attr_accessor :id
|
70
|
+
|
71
|
+
# The fields that have some problems and don't pass validation
|
72
|
+
attr_accessor :errors
|
73
|
+
|
74
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
75
|
+
def self.attribute_map
|
76
|
+
{
|
77
|
+
:'requested_amount' => :'requested_amount',
|
78
|
+
:'requested_currency' => :'requested_currency',
|
79
|
+
:'payout_method' => :'payout_method',
|
80
|
+
:'metadata' => :'metadata',
|
81
|
+
:'created_at' => :'created_at',
|
82
|
+
:'editable' => :'editable',
|
83
|
+
:'input_usd_amount' => :'input_usd_amount',
|
84
|
+
:'may_cancel' => :'may_cancel',
|
85
|
+
:'state_reason' => :'state_reason',
|
86
|
+
:'state' => :'state',
|
87
|
+
:'transaction_id' => :'transaction_id',
|
88
|
+
:'transaction_state' => :'transaction_state',
|
89
|
+
:'exchange_rate' => :'exchange_rate',
|
90
|
+
:'fee_fractional' => :'fee_fractional',
|
91
|
+
:'input_amount' => :'input_amount',
|
92
|
+
:'input_currency' => :'input_currency',
|
93
|
+
:'output_amount' => :'output_amount',
|
94
|
+
:'output_currency' => :'output_currency',
|
95
|
+
:'id' => :'id',
|
96
|
+
:'errors' => :'errors'
|
97
|
+
}
|
98
|
+
end
|
99
|
+
|
100
|
+
# Attribute type mapping.
|
101
|
+
def self.openapi_types
|
102
|
+
{
|
103
|
+
:'requested_amount' => :'Float',
|
104
|
+
:'requested_currency' => :'String',
|
105
|
+
:'payout_method' => :'PayoutMethod',
|
106
|
+
:'metadata' => :'Object',
|
107
|
+
:'created_at' => :'DateTime',
|
108
|
+
:'editable' => :'Boolean',
|
109
|
+
:'input_usd_amount' => :'Float',
|
110
|
+
:'may_cancel' => :'Boolean',
|
111
|
+
:'state_reason' => :'String',
|
112
|
+
:'state' => :'RecipientState',
|
113
|
+
:'transaction_id' => :'String',
|
114
|
+
:'transaction_state' => :'TransactionState',
|
115
|
+
:'exchange_rate' => :'Float',
|
116
|
+
:'fee_fractional' => :'Float',
|
117
|
+
:'input_amount' => :'Float',
|
118
|
+
:'input_currency' => :'String',
|
119
|
+
:'output_amount' => :'Float',
|
120
|
+
:'output_currency' => :'String',
|
121
|
+
:'id' => :'String',
|
122
|
+
:'errors' => :'Hash<String, Array<ValidationErrorDescription>>'
|
123
|
+
}
|
124
|
+
end
|
125
|
+
|
126
|
+
# Initializes the object
|
127
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
128
|
+
def initialize(attributes = {})
|
129
|
+
if (!attributes.is_a?(Hash))
|
130
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::Recipient` initialize method"
|
131
|
+
end
|
132
|
+
|
133
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
134
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
135
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
136
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::Recipient`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
137
|
+
end
|
138
|
+
h[k.to_sym] = v
|
139
|
+
}
|
140
|
+
|
141
|
+
if attributes.key?(:'requested_amount')
|
142
|
+
self.requested_amount = attributes[:'requested_amount']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.key?(:'requested_currency')
|
146
|
+
self.requested_currency = attributes[:'requested_currency']
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.key?(:'payout_method')
|
150
|
+
self.payout_method = attributes[:'payout_method']
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.key?(:'metadata')
|
154
|
+
self.metadata = attributes[:'metadata']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.key?(:'created_at')
|
158
|
+
self.created_at = attributes[:'created_at']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.key?(:'editable')
|
162
|
+
self.editable = attributes[:'editable']
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.key?(:'input_usd_amount')
|
166
|
+
self.input_usd_amount = attributes[:'input_usd_amount']
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.key?(:'may_cancel')
|
170
|
+
self.may_cancel = attributes[:'may_cancel']
|
171
|
+
end
|
172
|
+
|
173
|
+
if attributes.key?(:'state_reason')
|
174
|
+
self.state_reason = attributes[:'state_reason']
|
175
|
+
end
|
176
|
+
|
177
|
+
if attributes.key?(:'state')
|
178
|
+
self.state = attributes[:'state']
|
179
|
+
end
|
180
|
+
|
181
|
+
if attributes.key?(:'transaction_id')
|
182
|
+
self.transaction_id = attributes[:'transaction_id']
|
183
|
+
end
|
184
|
+
|
185
|
+
if attributes.key?(:'transaction_state')
|
186
|
+
self.transaction_state = attributes[:'transaction_state']
|
187
|
+
end
|
188
|
+
|
189
|
+
if attributes.key?(:'exchange_rate')
|
190
|
+
self.exchange_rate = attributes[:'exchange_rate']
|
191
|
+
end
|
192
|
+
|
193
|
+
if attributes.key?(:'fee_fractional')
|
194
|
+
self.fee_fractional = attributes[:'fee_fractional']
|
195
|
+
end
|
196
|
+
|
197
|
+
if attributes.key?(:'input_amount')
|
198
|
+
self.input_amount = attributes[:'input_amount']
|
199
|
+
end
|
200
|
+
|
201
|
+
if attributes.key?(:'input_currency')
|
202
|
+
self.input_currency = attributes[:'input_currency']
|
203
|
+
end
|
204
|
+
|
205
|
+
if attributes.key?(:'output_amount')
|
206
|
+
self.output_amount = attributes[:'output_amount']
|
207
|
+
end
|
208
|
+
|
209
|
+
if attributes.key?(:'output_currency')
|
210
|
+
self.output_currency = attributes[:'output_currency']
|
211
|
+
end
|
212
|
+
|
213
|
+
if attributes.key?(:'id')
|
214
|
+
self.id = attributes[:'id']
|
215
|
+
end
|
216
|
+
|
217
|
+
if attributes.key?(:'errors')
|
218
|
+
if (value = attributes[:'errors']).is_a?(Hash)
|
219
|
+
self.errors = value
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
225
|
+
# @return Array for valid properties with the reasons
|
226
|
+
def list_invalid_properties
|
227
|
+
invalid_properties = Array.new
|
228
|
+
if @requested_amount.nil?
|
229
|
+
invalid_properties.push('invalid value for "requested_amount", requested_amount cannot be nil.')
|
230
|
+
end
|
231
|
+
|
232
|
+
if @requested_currency.nil?
|
233
|
+
invalid_properties.push('invalid value for "requested_currency", requested_currency cannot be nil.')
|
234
|
+
end
|
235
|
+
|
236
|
+
if @payout_method.nil?
|
237
|
+
invalid_properties.push('invalid value for "payout_method", payout_method cannot be nil.')
|
238
|
+
end
|
239
|
+
|
240
|
+
invalid_properties
|
241
|
+
end
|
242
|
+
|
243
|
+
# Check to see if the all the properties in the model are valid
|
244
|
+
# @return true if the model is valid
|
245
|
+
def valid?
|
246
|
+
return false if @requested_amount.nil?
|
247
|
+
return false if @requested_currency.nil?
|
248
|
+
return false if @payout_method.nil?
|
249
|
+
true
|
250
|
+
end
|
251
|
+
|
252
|
+
# Checks equality by comparing each attribute.
|
253
|
+
# @param [Object] Object to be compared
|
254
|
+
def ==(o)
|
255
|
+
return true if self.equal?(o)
|
256
|
+
self.class == o.class &&
|
257
|
+
requested_amount == o.requested_amount &&
|
258
|
+
requested_currency == o.requested_currency &&
|
259
|
+
payout_method == o.payout_method &&
|
260
|
+
metadata == o.metadata &&
|
261
|
+
created_at == o.created_at &&
|
262
|
+
editable == o.editable &&
|
263
|
+
input_usd_amount == o.input_usd_amount &&
|
264
|
+
may_cancel == o.may_cancel &&
|
265
|
+
state_reason == o.state_reason &&
|
266
|
+
state == o.state &&
|
267
|
+
transaction_id == o.transaction_id &&
|
268
|
+
transaction_state == o.transaction_state &&
|
269
|
+
exchange_rate == o.exchange_rate &&
|
270
|
+
fee_fractional == o.fee_fractional &&
|
271
|
+
input_amount == o.input_amount &&
|
272
|
+
input_currency == o.input_currency &&
|
273
|
+
output_amount == o.output_amount &&
|
274
|
+
output_currency == o.output_currency &&
|
275
|
+
id == o.id &&
|
276
|
+
errors == o.errors
|
277
|
+
end
|
278
|
+
|
279
|
+
# @see the `==` method
|
280
|
+
# @param [Object] Object to be compared
|
281
|
+
def eql?(o)
|
282
|
+
self == o
|
283
|
+
end
|
284
|
+
|
285
|
+
# Calculates hash code according to all attributes.
|
286
|
+
# @return [Integer] Hash code
|
287
|
+
def hash
|
288
|
+
[requested_amount, requested_currency, payout_method, metadata, created_at, editable, input_usd_amount, may_cancel, state_reason, state, transaction_id, transaction_state, exchange_rate, fee_fractional, input_amount, input_currency, output_amount, output_currency, id, errors].hash
|
289
|
+
end
|
290
|
+
|
291
|
+
require 'active_support/core_ext/hash'
|
292
|
+
require 'active_support/hash_with_indifferent_access.rb'
|
293
|
+
# Builds the object from hash
|
294
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
295
|
+
# @return [Object] Returns the model itself
|
296
|
+
def build_from_hash(attributes)
|
297
|
+
return nil unless attributes.is_a?(Hash)
|
298
|
+
self.class.openapi_types.each_pair do |key, type|
|
299
|
+
if type =~ /\AArray<(.*)>/i
|
300
|
+
# check to ensure the input is an array given that the the attribute
|
301
|
+
# is documented as an array but the input is not
|
302
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
303
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
304
|
+
end
|
305
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
306
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
307
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
308
|
+
end
|
309
|
+
|
310
|
+
self
|
311
|
+
end
|
312
|
+
|
313
|
+
# Deserializes the data based on type
|
314
|
+
# @param string type Data type
|
315
|
+
# @param string value Value to be deserialized
|
316
|
+
# @return [Object] Deserialized data
|
317
|
+
def _deserialize(type, value)
|
318
|
+
case type.to_sym
|
319
|
+
when :DateTime
|
320
|
+
DateTime.parse(value)
|
321
|
+
when :Date
|
322
|
+
Date.parse(value)
|
323
|
+
when :String
|
324
|
+
value.to_s
|
325
|
+
when :Integer
|
326
|
+
value.to_i
|
327
|
+
when :Float
|
328
|
+
value.to_f
|
329
|
+
when :Boolean
|
330
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
331
|
+
true
|
332
|
+
else
|
333
|
+
false
|
334
|
+
end
|
335
|
+
when :Object
|
336
|
+
# generic object (usually a Hash), return directly
|
337
|
+
value
|
338
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
339
|
+
inner_type = Regexp.last_match[:inner_type]
|
340
|
+
value.map { |v| _deserialize(inner_type, v) }
|
341
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
342
|
+
k_type = Regexp.last_match[:k_type]
|
343
|
+
v_type = Regexp.last_match[:v_type]
|
344
|
+
{}.tap do |hash|
|
345
|
+
value.each do |k, v|
|
346
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
347
|
+
end
|
348
|
+
end
|
349
|
+
else # model
|
350
|
+
temp_model = TransferZero.const_get(type).new
|
351
|
+
temp_model.build_from_hash(value)
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
# Returns the string representation of the object
|
356
|
+
# @return [String] String presentation of the object
|
357
|
+
def to_s
|
358
|
+
to_hash.to_s
|
359
|
+
end
|
360
|
+
|
361
|
+
# to_body is an alias to to_hash (backward compatibility)
|
362
|
+
# @return [Hash] Returns the object in the form of hash
|
363
|
+
def to_body
|
364
|
+
to_hash
|
365
|
+
end
|
366
|
+
|
367
|
+
# Returns the object in the form of hash
|
368
|
+
# @return [Hash] Returns the object in the form of hash
|
369
|
+
def to_hash
|
370
|
+
hash = {}
|
371
|
+
self.class.attribute_map.each_pair do |attr, param|
|
372
|
+
value = self.send(attr)
|
373
|
+
next if value.nil?
|
374
|
+
hash[param] = _to_hash(value)
|
375
|
+
end
|
376
|
+
::ActiveSupport::HashWithIndifferentAccess.new(hash)
|
377
|
+
end
|
378
|
+
|
379
|
+
def [](key)
|
380
|
+
to_hash[key]
|
381
|
+
end
|
382
|
+
|
383
|
+
def dig(*args)
|
384
|
+
to_hash.dig(*args)
|
385
|
+
end
|
386
|
+
|
387
|
+
# Outputs non-array value in the form of hash
|
388
|
+
# For object, use to_hash. Otherwise, just return the value
|
389
|
+
# @param [Object] value Any valid value
|
390
|
+
# @return [Hash] Returns the value in the form of hash
|
391
|
+
def _to_hash(value)
|
392
|
+
if value.is_a?(Array)
|
393
|
+
value.compact.map { |v| _to_hash(v) }
|
394
|
+
elsif value.is_a?(Hash)
|
395
|
+
{}.tap do |hash|
|
396
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
397
|
+
end
|
398
|
+
elsif value.respond_to? :to_hash
|
399
|
+
value.to_hash
|
400
|
+
else
|
401
|
+
value
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
405
|
+
end
|
406
|
+
end
|
@@ -0,0 +1,212 @@
|
|
1
|
+
=begin
|
2
|
+
#TransferZero API
|
3
|
+
|
4
|
+
#Reference documentation for the TransferZero API V1
|
5
|
+
|
6
|
+
OpenAPI spec version: 1.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.0.0-beta3
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module TransferZero
|
16
|
+
class RecipientListResponse
|
17
|
+
attr_accessor :object
|
18
|
+
|
19
|
+
attr_accessor :meta
|
20
|
+
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
22
|
+
def self.attribute_map
|
23
|
+
{
|
24
|
+
:'object' => :'object',
|
25
|
+
:'meta' => :'meta'
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
# Attribute type mapping.
|
30
|
+
def self.openapi_types
|
31
|
+
{
|
32
|
+
:'object' => :'Array<Recipient>',
|
33
|
+
:'meta' => :'PaginationMeta'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
# Initializes the object
|
38
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
39
|
+
def initialize(attributes = {})
|
40
|
+
if (!attributes.is_a?(Hash))
|
41
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::RecipientListResponse` initialize method"
|
42
|
+
end
|
43
|
+
|
44
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
45
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
46
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
47
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::RecipientListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
48
|
+
end
|
49
|
+
h[k.to_sym] = v
|
50
|
+
}
|
51
|
+
|
52
|
+
if attributes.key?(:'object')
|
53
|
+
if (value = attributes[:'object']).is_a?(Array)
|
54
|
+
self.object = value
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes.key?(:'meta')
|
59
|
+
self.meta = attributes[:'meta']
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
64
|
+
# @return Array for valid properties with the reasons
|
65
|
+
def list_invalid_properties
|
66
|
+
invalid_properties = Array.new
|
67
|
+
invalid_properties
|
68
|
+
end
|
69
|
+
|
70
|
+
# Check to see if the all the properties in the model are valid
|
71
|
+
# @return true if the model is valid
|
72
|
+
def valid?
|
73
|
+
true
|
74
|
+
end
|
75
|
+
|
76
|
+
# Checks equality by comparing each attribute.
|
77
|
+
# @param [Object] Object to be compared
|
78
|
+
def ==(o)
|
79
|
+
return true if self.equal?(o)
|
80
|
+
self.class == o.class &&
|
81
|
+
object == o.object &&
|
82
|
+
meta == o.meta
|
83
|
+
end
|
84
|
+
|
85
|
+
# @see the `==` method
|
86
|
+
# @param [Object] Object to be compared
|
87
|
+
def eql?(o)
|
88
|
+
self == o
|
89
|
+
end
|
90
|
+
|
91
|
+
# Calculates hash code according to all attributes.
|
92
|
+
# @return [Integer] Hash code
|
93
|
+
def hash
|
94
|
+
[object, meta].hash
|
95
|
+
end
|
96
|
+
|
97
|
+
require 'active_support/core_ext/hash'
|
98
|
+
require 'active_support/hash_with_indifferent_access.rb'
|
99
|
+
# Builds the object from hash
|
100
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
101
|
+
# @return [Object] Returns the model itself
|
102
|
+
def build_from_hash(attributes)
|
103
|
+
return nil unless attributes.is_a?(Hash)
|
104
|
+
self.class.openapi_types.each_pair do |key, type|
|
105
|
+
if type =~ /\AArray<(.*)>/i
|
106
|
+
# check to ensure the input is an array given that the the attribute
|
107
|
+
# is documented as an array but the input is not
|
108
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
109
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
110
|
+
end
|
111
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
112
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
113
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
114
|
+
end
|
115
|
+
|
116
|
+
self
|
117
|
+
end
|
118
|
+
|
119
|
+
# Deserializes the data based on type
|
120
|
+
# @param string type Data type
|
121
|
+
# @param string value Value to be deserialized
|
122
|
+
# @return [Object] Deserialized data
|
123
|
+
def _deserialize(type, value)
|
124
|
+
case type.to_sym
|
125
|
+
when :DateTime
|
126
|
+
DateTime.parse(value)
|
127
|
+
when :Date
|
128
|
+
Date.parse(value)
|
129
|
+
when :String
|
130
|
+
value.to_s
|
131
|
+
when :Integer
|
132
|
+
value.to_i
|
133
|
+
when :Float
|
134
|
+
value.to_f
|
135
|
+
when :Boolean
|
136
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
137
|
+
true
|
138
|
+
else
|
139
|
+
false
|
140
|
+
end
|
141
|
+
when :Object
|
142
|
+
# generic object (usually a Hash), return directly
|
143
|
+
value
|
144
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
145
|
+
inner_type = Regexp.last_match[:inner_type]
|
146
|
+
value.map { |v| _deserialize(inner_type, v) }
|
147
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
148
|
+
k_type = Regexp.last_match[:k_type]
|
149
|
+
v_type = Regexp.last_match[:v_type]
|
150
|
+
{}.tap do |hash|
|
151
|
+
value.each do |k, v|
|
152
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
else # model
|
156
|
+
temp_model = TransferZero.const_get(type).new
|
157
|
+
temp_model.build_from_hash(value)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
# Returns the string representation of the object
|
162
|
+
# @return [String] String presentation of the object
|
163
|
+
def to_s
|
164
|
+
to_hash.to_s
|
165
|
+
end
|
166
|
+
|
167
|
+
# to_body is an alias to to_hash (backward compatibility)
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_body
|
170
|
+
to_hash
|
171
|
+
end
|
172
|
+
|
173
|
+
# Returns the object in the form of hash
|
174
|
+
# @return [Hash] Returns the object in the form of hash
|
175
|
+
def to_hash
|
176
|
+
hash = {}
|
177
|
+
self.class.attribute_map.each_pair do |attr, param|
|
178
|
+
value = self.send(attr)
|
179
|
+
next if value.nil?
|
180
|
+
hash[param] = _to_hash(value)
|
181
|
+
end
|
182
|
+
::ActiveSupport::HashWithIndifferentAccess.new(hash)
|
183
|
+
end
|
184
|
+
|
185
|
+
def [](key)
|
186
|
+
to_hash[key]
|
187
|
+
end
|
188
|
+
|
189
|
+
def dig(*args)
|
190
|
+
to_hash.dig(*args)
|
191
|
+
end
|
192
|
+
|
193
|
+
# Outputs non-array value in the form of hash
|
194
|
+
# For object, use to_hash. Otherwise, just return the value
|
195
|
+
# @param [Object] value Any valid value
|
196
|
+
# @return [Hash] Returns the value in the form of hash
|
197
|
+
def _to_hash(value)
|
198
|
+
if value.is_a?(Array)
|
199
|
+
value.compact.map { |v| _to_hash(v) }
|
200
|
+
elsif value.is_a?(Hash)
|
201
|
+
{}.tap do |hash|
|
202
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
203
|
+
end
|
204
|
+
elsif value.respond_to? :to_hash
|
205
|
+
value.to_hash
|
206
|
+
else
|
207
|
+
value
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
end
|