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,258 @@
|
|
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
|
+
# ```JSON \"details\": { \"first_name\": \"First\", \"last_name\": \"Last\", \"bank_name\": \"Deutsche Bank\", \"iban\": \"DE89370400440532013000\", \"bic\": \"DEUTDEBBXXX\" // Optional } ```
|
17
|
+
class PayoutMethodDetailsIBAN
|
18
|
+
attr_accessor :first_name
|
19
|
+
|
20
|
+
attr_accessor :last_name
|
21
|
+
|
22
|
+
attr_accessor :bank_name
|
23
|
+
|
24
|
+
attr_accessor :iban
|
25
|
+
|
26
|
+
attr_accessor :bic
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'first_name' => :'first_name',
|
32
|
+
:'last_name' => :'last_name',
|
33
|
+
:'bank_name' => :'bank_name',
|
34
|
+
:'iban' => :'iban',
|
35
|
+
:'bic' => :'bic'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.openapi_types
|
41
|
+
{
|
42
|
+
:'first_name' => :'String',
|
43
|
+
:'last_name' => :'String',
|
44
|
+
:'bank_name' => :'String',
|
45
|
+
:'iban' => :'String',
|
46
|
+
:'bic' => :'String'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PayoutMethodDetailsIBAN` initialize method"
|
55
|
+
end
|
56
|
+
|
57
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PayoutMethodDetailsIBAN`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
+
end
|
62
|
+
h[k.to_sym] = v
|
63
|
+
}
|
64
|
+
|
65
|
+
if attributes.key?(:'first_name')
|
66
|
+
self.first_name = attributes[:'first_name']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.key?(:'last_name')
|
70
|
+
self.last_name = attributes[:'last_name']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'bank_name')
|
74
|
+
self.bank_name = attributes[:'bank_name']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.key?(:'iban')
|
78
|
+
self.iban = attributes[:'iban']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.key?(:'bic')
|
82
|
+
self.bic = attributes[:'bic']
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
87
|
+
# @return Array for valid properties with the reasons
|
88
|
+
def list_invalid_properties
|
89
|
+
invalid_properties = Array.new
|
90
|
+
if @first_name.nil?
|
91
|
+
invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
|
92
|
+
end
|
93
|
+
|
94
|
+
if @last_name.nil?
|
95
|
+
invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
|
96
|
+
end
|
97
|
+
|
98
|
+
if @bank_name.nil?
|
99
|
+
invalid_properties.push('invalid value for "bank_name", bank_name cannot be nil.')
|
100
|
+
end
|
101
|
+
|
102
|
+
if @iban.nil?
|
103
|
+
invalid_properties.push('invalid value for "iban", iban cannot be nil.')
|
104
|
+
end
|
105
|
+
|
106
|
+
invalid_properties
|
107
|
+
end
|
108
|
+
|
109
|
+
# Check to see if the all the properties in the model are valid
|
110
|
+
# @return true if the model is valid
|
111
|
+
def valid?
|
112
|
+
return false if @first_name.nil?
|
113
|
+
return false if @last_name.nil?
|
114
|
+
return false if @bank_name.nil?
|
115
|
+
return false if @iban.nil?
|
116
|
+
true
|
117
|
+
end
|
118
|
+
|
119
|
+
# Checks equality by comparing each attribute.
|
120
|
+
# @param [Object] Object to be compared
|
121
|
+
def ==(o)
|
122
|
+
return true if self.equal?(o)
|
123
|
+
self.class == o.class &&
|
124
|
+
first_name == o.first_name &&
|
125
|
+
last_name == o.last_name &&
|
126
|
+
bank_name == o.bank_name &&
|
127
|
+
iban == o.iban &&
|
128
|
+
bic == o.bic
|
129
|
+
end
|
130
|
+
|
131
|
+
# @see the `==` method
|
132
|
+
# @param [Object] Object to be compared
|
133
|
+
def eql?(o)
|
134
|
+
self == o
|
135
|
+
end
|
136
|
+
|
137
|
+
# Calculates hash code according to all attributes.
|
138
|
+
# @return [Integer] Hash code
|
139
|
+
def hash
|
140
|
+
[first_name, last_name, bank_name, iban, bic].hash
|
141
|
+
end
|
142
|
+
|
143
|
+
require 'active_support/core_ext/hash'
|
144
|
+
require 'active_support/hash_with_indifferent_access.rb'
|
145
|
+
# Builds the object from hash
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
# @return [Object] Returns the model itself
|
148
|
+
def build_from_hash(attributes)
|
149
|
+
return nil unless attributes.is_a?(Hash)
|
150
|
+
self.class.openapi_types.each_pair do |key, type|
|
151
|
+
if type =~ /\AArray<(.*)>/i
|
152
|
+
# check to ensure the input is an array given that the the attribute
|
153
|
+
# is documented as an array but the input is not
|
154
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
155
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
156
|
+
end
|
157
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
158
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
159
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
160
|
+
end
|
161
|
+
|
162
|
+
self
|
163
|
+
end
|
164
|
+
|
165
|
+
# Deserializes the data based on type
|
166
|
+
# @param string type Data type
|
167
|
+
# @param string value Value to be deserialized
|
168
|
+
# @return [Object] Deserialized data
|
169
|
+
def _deserialize(type, value)
|
170
|
+
case type.to_sym
|
171
|
+
when :DateTime
|
172
|
+
DateTime.parse(value)
|
173
|
+
when :Date
|
174
|
+
Date.parse(value)
|
175
|
+
when :String
|
176
|
+
value.to_s
|
177
|
+
when :Integer
|
178
|
+
value.to_i
|
179
|
+
when :Float
|
180
|
+
value.to_f
|
181
|
+
when :Boolean
|
182
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
183
|
+
true
|
184
|
+
else
|
185
|
+
false
|
186
|
+
end
|
187
|
+
when :Object
|
188
|
+
# generic object (usually a Hash), return directly
|
189
|
+
value
|
190
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
191
|
+
inner_type = Regexp.last_match[:inner_type]
|
192
|
+
value.map { |v| _deserialize(inner_type, v) }
|
193
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
194
|
+
k_type = Regexp.last_match[:k_type]
|
195
|
+
v_type = Regexp.last_match[:v_type]
|
196
|
+
{}.tap do |hash|
|
197
|
+
value.each do |k, v|
|
198
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
else # model
|
202
|
+
temp_model = TransferZero.const_get(type).new
|
203
|
+
temp_model.build_from_hash(value)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
# Returns the string representation of the object
|
208
|
+
# @return [String] String presentation of the object
|
209
|
+
def to_s
|
210
|
+
to_hash.to_s
|
211
|
+
end
|
212
|
+
|
213
|
+
# to_body is an alias to to_hash (backward compatibility)
|
214
|
+
# @return [Hash] Returns the object in the form of hash
|
215
|
+
def to_body
|
216
|
+
to_hash
|
217
|
+
end
|
218
|
+
|
219
|
+
# Returns the object in the form of hash
|
220
|
+
# @return [Hash] Returns the object in the form of hash
|
221
|
+
def to_hash
|
222
|
+
hash = {}
|
223
|
+
self.class.attribute_map.each_pair do |attr, param|
|
224
|
+
value = self.send(attr)
|
225
|
+
next if value.nil?
|
226
|
+
hash[param] = _to_hash(value)
|
227
|
+
end
|
228
|
+
::ActiveSupport::HashWithIndifferentAccess.new(hash)
|
229
|
+
end
|
230
|
+
|
231
|
+
def [](key)
|
232
|
+
to_hash[key]
|
233
|
+
end
|
234
|
+
|
235
|
+
def dig(*args)
|
236
|
+
to_hash.dig(*args)
|
237
|
+
end
|
238
|
+
|
239
|
+
# Outputs non-array value in the form of hash
|
240
|
+
# For object, use to_hash. Otherwise, just return the value
|
241
|
+
# @param [Object] value Any valid value
|
242
|
+
# @return [Hash] Returns the value in the form of hash
|
243
|
+
def _to_hash(value)
|
244
|
+
if value.is_a?(Array)
|
245
|
+
value.compact.map { |v| _to_hash(v) }
|
246
|
+
elsif value.is_a?(Hash)
|
247
|
+
{}.tap do |hash|
|
248
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
249
|
+
end
|
250
|
+
elsif value.respond_to? :to_hash
|
251
|
+
value.to_hash
|
252
|
+
else
|
253
|
+
value
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
end
|
258
|
+
end
|
@@ -0,0 +1,332 @@
|
|
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
|
+
# ```JSON \"details\": { \"first_name\": \"First\", \"last_name\": \"Last\", \"phone_number\": \"212537718685\" # Mandatory; International format preferred \"sender_identity_card_type\" => \"O\", # Mandatory; Values: \"O\": Other, \"PP\": Passport, \"NI\": National ID \"sender_identity_card_id\" => 'AB12345678', # Mandatory \"sender_city_of_birth\" => \"London\", # Mandatory \"sender_country_of_birth\" => \"GB\", # Mandatory; ISO 2-letter format \"sender_gender\" => \"M\", # Mandatory; Values: \"M\": Male, \"F\": Female \"reason\" => \"Remittance payment\", # Optional; Default value is 'Remittance payment' \"identity_card_type\" => \"NI\", # Optional; Values: \"PP\": Passport, \"NI\": National ID \"identity_card_id\" => 'AB12345678' # Optional } ``` Please note when sending MAD::Cash payments you should subscribe to the recipient.pending webhook, as that will broadcast the payment reference ID the customer need to use to obtain the funds. Example webhook response excerpt - ```JSON { (...) \"state\":\"pending\", \"metadata\": { \"payment_reference\":\"9M5GJRJUBCY\" }, (...) } ``` The reference can also be provided optionally for MAD::Cash, but if you want to use this functionality please contact us for more details.
|
17
|
+
class PayoutMethodDetailsMADCash
|
18
|
+
attr_accessor :first_name
|
19
|
+
|
20
|
+
attr_accessor :last_name
|
21
|
+
|
22
|
+
attr_accessor :phone_number
|
23
|
+
|
24
|
+
attr_accessor :sender_identity_card_type
|
25
|
+
|
26
|
+
attr_accessor :sender_identity_card_id
|
27
|
+
|
28
|
+
attr_accessor :sender_city_of_birth
|
29
|
+
|
30
|
+
attr_accessor :sender_country_of_birth
|
31
|
+
|
32
|
+
attr_accessor :sender_gender
|
33
|
+
|
34
|
+
attr_accessor :reason
|
35
|
+
|
36
|
+
attr_accessor :identity_card_type
|
37
|
+
|
38
|
+
attr_accessor :identity_card_id
|
39
|
+
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
+
def self.attribute_map
|
42
|
+
{
|
43
|
+
:'first_name' => :'first_name',
|
44
|
+
:'last_name' => :'last_name',
|
45
|
+
:'phone_number' => :'phone_number',
|
46
|
+
:'sender_identity_card_type' => :'sender_identity_card_type',
|
47
|
+
:'sender_identity_card_id' => :'sender_identity_card_id',
|
48
|
+
:'sender_city_of_birth' => :'sender_city_of_birth',
|
49
|
+
:'sender_country_of_birth' => :'sender_country_of_birth',
|
50
|
+
:'sender_gender' => :'sender_gender',
|
51
|
+
:'reason' => :'reason',
|
52
|
+
:'identity_card_type' => :'identity_card_type',
|
53
|
+
:'identity_card_id' => :'identity_card_id'
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# Attribute type mapping.
|
58
|
+
def self.openapi_types
|
59
|
+
{
|
60
|
+
:'first_name' => :'String',
|
61
|
+
:'last_name' => :'String',
|
62
|
+
:'phone_number' => :'String',
|
63
|
+
:'sender_identity_card_type' => :'PayoutMethodIdentityCardTypeEnum',
|
64
|
+
:'sender_identity_card_id' => :'String',
|
65
|
+
:'sender_city_of_birth' => :'String',
|
66
|
+
:'sender_country_of_birth' => :'String',
|
67
|
+
:'sender_gender' => :'PayoutMethodGenderEnum',
|
68
|
+
:'reason' => :'String',
|
69
|
+
:'identity_card_type' => :'PayoutMethodIdentityCardTypeEnum',
|
70
|
+
:'identity_card_id' => :'String'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
# Initializes the object
|
75
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
76
|
+
def initialize(attributes = {})
|
77
|
+
if (!attributes.is_a?(Hash))
|
78
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TransferZero::PayoutMethodDetailsMADCash` initialize method"
|
79
|
+
end
|
80
|
+
|
81
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
82
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
83
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
84
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TransferZero::PayoutMethodDetailsMADCash`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
85
|
+
end
|
86
|
+
h[k.to_sym] = v
|
87
|
+
}
|
88
|
+
|
89
|
+
if attributes.key?(:'first_name')
|
90
|
+
self.first_name = attributes[:'first_name']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.key?(:'last_name')
|
94
|
+
self.last_name = attributes[:'last_name']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'phone_number')
|
98
|
+
self.phone_number = attributes[:'phone_number']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'sender_identity_card_type')
|
102
|
+
self.sender_identity_card_type = attributes[:'sender_identity_card_type']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'sender_identity_card_id')
|
106
|
+
self.sender_identity_card_id = attributes[:'sender_identity_card_id']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'sender_city_of_birth')
|
110
|
+
self.sender_city_of_birth = attributes[:'sender_city_of_birth']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'sender_country_of_birth')
|
114
|
+
self.sender_country_of_birth = attributes[:'sender_country_of_birth']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'sender_gender')
|
118
|
+
self.sender_gender = attributes[:'sender_gender']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.key?(:'reason')
|
122
|
+
self.reason = attributes[:'reason']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.key?(:'identity_card_type')
|
126
|
+
self.identity_card_type = attributes[:'identity_card_type']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.key?(:'identity_card_id')
|
130
|
+
self.identity_card_id = attributes[:'identity_card_id']
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
135
|
+
# @return Array for valid properties with the reasons
|
136
|
+
def list_invalid_properties
|
137
|
+
invalid_properties = Array.new
|
138
|
+
if @first_name.nil?
|
139
|
+
invalid_properties.push('invalid value for "first_name", first_name cannot be nil.')
|
140
|
+
end
|
141
|
+
|
142
|
+
if @last_name.nil?
|
143
|
+
invalid_properties.push('invalid value for "last_name", last_name cannot be nil.')
|
144
|
+
end
|
145
|
+
|
146
|
+
if @phone_number.nil?
|
147
|
+
invalid_properties.push('invalid value for "phone_number", phone_number cannot be nil.')
|
148
|
+
end
|
149
|
+
|
150
|
+
if @sender_identity_card_type.nil?
|
151
|
+
invalid_properties.push('invalid value for "sender_identity_card_type", sender_identity_card_type cannot be nil.')
|
152
|
+
end
|
153
|
+
|
154
|
+
if @sender_identity_card_id.nil?
|
155
|
+
invalid_properties.push('invalid value for "sender_identity_card_id", sender_identity_card_id cannot be nil.')
|
156
|
+
end
|
157
|
+
|
158
|
+
if @sender_city_of_birth.nil?
|
159
|
+
invalid_properties.push('invalid value for "sender_city_of_birth", sender_city_of_birth cannot be nil.')
|
160
|
+
end
|
161
|
+
|
162
|
+
if @sender_country_of_birth.nil?
|
163
|
+
invalid_properties.push('invalid value for "sender_country_of_birth", sender_country_of_birth cannot be nil.')
|
164
|
+
end
|
165
|
+
|
166
|
+
if @sender_gender.nil?
|
167
|
+
invalid_properties.push('invalid value for "sender_gender", sender_gender cannot be nil.')
|
168
|
+
end
|
169
|
+
|
170
|
+
invalid_properties
|
171
|
+
end
|
172
|
+
|
173
|
+
# Check to see if the all the properties in the model are valid
|
174
|
+
# @return true if the model is valid
|
175
|
+
def valid?
|
176
|
+
return false if @first_name.nil?
|
177
|
+
return false if @last_name.nil?
|
178
|
+
return false if @phone_number.nil?
|
179
|
+
return false if @sender_identity_card_type.nil?
|
180
|
+
return false if @sender_identity_card_id.nil?
|
181
|
+
return false if @sender_city_of_birth.nil?
|
182
|
+
return false if @sender_country_of_birth.nil?
|
183
|
+
return false if @sender_gender.nil?
|
184
|
+
true
|
185
|
+
end
|
186
|
+
|
187
|
+
# Checks equality by comparing each attribute.
|
188
|
+
# @param [Object] Object to be compared
|
189
|
+
def ==(o)
|
190
|
+
return true if self.equal?(o)
|
191
|
+
self.class == o.class &&
|
192
|
+
first_name == o.first_name &&
|
193
|
+
last_name == o.last_name &&
|
194
|
+
phone_number == o.phone_number &&
|
195
|
+
sender_identity_card_type == o.sender_identity_card_type &&
|
196
|
+
sender_identity_card_id == o.sender_identity_card_id &&
|
197
|
+
sender_city_of_birth == o.sender_city_of_birth &&
|
198
|
+
sender_country_of_birth == o.sender_country_of_birth &&
|
199
|
+
sender_gender == o.sender_gender &&
|
200
|
+
reason == o.reason &&
|
201
|
+
identity_card_type == o.identity_card_type &&
|
202
|
+
identity_card_id == o.identity_card_id
|
203
|
+
end
|
204
|
+
|
205
|
+
# @see the `==` method
|
206
|
+
# @param [Object] Object to be compared
|
207
|
+
def eql?(o)
|
208
|
+
self == o
|
209
|
+
end
|
210
|
+
|
211
|
+
# Calculates hash code according to all attributes.
|
212
|
+
# @return [Integer] Hash code
|
213
|
+
def hash
|
214
|
+
[first_name, last_name, phone_number, sender_identity_card_type, sender_identity_card_id, sender_city_of_birth, sender_country_of_birth, sender_gender, reason, identity_card_type, identity_card_id].hash
|
215
|
+
end
|
216
|
+
|
217
|
+
require 'active_support/core_ext/hash'
|
218
|
+
require 'active_support/hash_with_indifferent_access.rb'
|
219
|
+
# Builds the object from hash
|
220
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
221
|
+
# @return [Object] Returns the model itself
|
222
|
+
def build_from_hash(attributes)
|
223
|
+
return nil unless attributes.is_a?(Hash)
|
224
|
+
self.class.openapi_types.each_pair do |key, type|
|
225
|
+
if type =~ /\AArray<(.*)>/i
|
226
|
+
# check to ensure the input is an array given that the the attribute
|
227
|
+
# is documented as an array but the input is not
|
228
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
229
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
230
|
+
end
|
231
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
232
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
233
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
234
|
+
end
|
235
|
+
|
236
|
+
self
|
237
|
+
end
|
238
|
+
|
239
|
+
# Deserializes the data based on type
|
240
|
+
# @param string type Data type
|
241
|
+
# @param string value Value to be deserialized
|
242
|
+
# @return [Object] Deserialized data
|
243
|
+
def _deserialize(type, value)
|
244
|
+
case type.to_sym
|
245
|
+
when :DateTime
|
246
|
+
DateTime.parse(value)
|
247
|
+
when :Date
|
248
|
+
Date.parse(value)
|
249
|
+
when :String
|
250
|
+
value.to_s
|
251
|
+
when :Integer
|
252
|
+
value.to_i
|
253
|
+
when :Float
|
254
|
+
value.to_f
|
255
|
+
when :Boolean
|
256
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
257
|
+
true
|
258
|
+
else
|
259
|
+
false
|
260
|
+
end
|
261
|
+
when :Object
|
262
|
+
# generic object (usually a Hash), return directly
|
263
|
+
value
|
264
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
265
|
+
inner_type = Regexp.last_match[:inner_type]
|
266
|
+
value.map { |v| _deserialize(inner_type, v) }
|
267
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
268
|
+
k_type = Regexp.last_match[:k_type]
|
269
|
+
v_type = Regexp.last_match[:v_type]
|
270
|
+
{}.tap do |hash|
|
271
|
+
value.each do |k, v|
|
272
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
273
|
+
end
|
274
|
+
end
|
275
|
+
else # model
|
276
|
+
temp_model = TransferZero.const_get(type).new
|
277
|
+
temp_model.build_from_hash(value)
|
278
|
+
end
|
279
|
+
end
|
280
|
+
|
281
|
+
# Returns the string representation of the object
|
282
|
+
# @return [String] String presentation of the object
|
283
|
+
def to_s
|
284
|
+
to_hash.to_s
|
285
|
+
end
|
286
|
+
|
287
|
+
# to_body is an alias to to_hash (backward compatibility)
|
288
|
+
# @return [Hash] Returns the object in the form of hash
|
289
|
+
def to_body
|
290
|
+
to_hash
|
291
|
+
end
|
292
|
+
|
293
|
+
# Returns the object in the form of hash
|
294
|
+
# @return [Hash] Returns the object in the form of hash
|
295
|
+
def to_hash
|
296
|
+
hash = {}
|
297
|
+
self.class.attribute_map.each_pair do |attr, param|
|
298
|
+
value = self.send(attr)
|
299
|
+
next if value.nil?
|
300
|
+
hash[param] = _to_hash(value)
|
301
|
+
end
|
302
|
+
::ActiveSupport::HashWithIndifferentAccess.new(hash)
|
303
|
+
end
|
304
|
+
|
305
|
+
def [](key)
|
306
|
+
to_hash[key]
|
307
|
+
end
|
308
|
+
|
309
|
+
def dig(*args)
|
310
|
+
to_hash.dig(*args)
|
311
|
+
end
|
312
|
+
|
313
|
+
# Outputs non-array value in the form of hash
|
314
|
+
# For object, use to_hash. Otherwise, just return the value
|
315
|
+
# @param [Object] value Any valid value
|
316
|
+
# @return [Hash] Returns the value in the form of hash
|
317
|
+
def _to_hash(value)
|
318
|
+
if value.is_a?(Array)
|
319
|
+
value.compact.map { |v| _to_hash(v) }
|
320
|
+
elsif value.is_a?(Hash)
|
321
|
+
{}.tap do |hash|
|
322
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
323
|
+
end
|
324
|
+
elsif value.respond_to? :to_hash
|
325
|
+
value.to_hash
|
326
|
+
else
|
327
|
+
value
|
328
|
+
end
|
329
|
+
end
|
330
|
+
|
331
|
+
end
|
332
|
+
end
|