transferzero-sdk 1.0.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.
- 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,79 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for TransferZero::RecipientsApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'RecipientsApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = TransferZero::RecipientsApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of RecipientsApi' do
|
30
|
+
it 'should create an instance of RecipientsApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(TransferZero::RecipientsApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for delete_recipient
|
36
|
+
# Cancelling a recipient
|
37
|
+
# Cancels the payment to the recipient specified in the URL path. Please note only recipients where the `may_cancel` attribute is true can be cancelled.
|
38
|
+
# @param recipient_id ID of recipient to cancel. Example: `/v1/recipients/9d4d7b73-a94c-4979-ab57-09074fd55d33`
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [RecipientResponse]
|
41
|
+
describe 'delete_recipient test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for get_recipients
|
48
|
+
# Getting a list of recipients with filtering
|
49
|
+
# Fetches details of all recipients.
|
50
|
+
# @param [Hash] opts the optional parameters
|
51
|
+
# @option opts [Integer] :page The page number to request (defaults to 1)
|
52
|
+
# @option opts [Integer] :per The number of results to load per page (defaults to 10)
|
53
|
+
# @option opts [String] :created_at_from Start date to filter recipients by created_at range Allows filtering results by the specified `created_at` timeframe. Example: `/v1/recipients?created_at_from=2018-06-06&created_at_to=2018-06-08`
|
54
|
+
# @option opts [String] :created_at_to End date to filter recipients by created_at range Allows filtering results by the specified `created_at` timeframe. Example: `/v1/recipients?created_at_from=2018-06-06&created_at_to=2018-06-08`
|
55
|
+
# @option opts [String] :amount_from Minimum amount to filter recipients by amount range. Allows filtering results by the specified `amount` range. When using this filter, the `currency` should also be specified. Example: `/v1/recipients?currency=NGN&amount_from=83.76672339&amount_to=83.76672339`
|
56
|
+
# @option opts [String] :amount_to Max amount to filter recipients by amount range. Allows filtering results by the specified `amount` range. When using this filter, the `currency` should also be specified. Example: `/v1/recipients?currency=NGN&amount_from=83.76672339&amount_to=83.76672339`
|
57
|
+
# @option opts [Array<String>] :state Allows filtering results by `state` of recipient. See [API Documentation - Recipient state](https://github.com/transferzero/api-documentation/blob/master/transaction-flow.md#state-1) for possible states. Example: `/v1/recipients?state[]=error&state[]=initial`
|
58
|
+
# @option opts [Array<String>] :currency Allows filtering results by `input_currency`. Additionally required when filtering by an amount range Example: `/v1/recipients?currency[]=KES&currency[]=NGN`
|
59
|
+
# @return [RecipientListResponse]
|
60
|
+
describe 'get_recipients test' do
|
61
|
+
it 'should work' do
|
62
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# unit tests for patch_recipient
|
67
|
+
# Updating a recipient
|
68
|
+
# Updates the recipient specified in the URL path. Please note that only recipients where the `editable` field is true can be modified. Once the recipient is modified any subsequent payout tries will be sent to the updated details.
|
69
|
+
# @param recipient_id ID of recipient to update. Example: `/v1/recipients/9d4d7b73-a94c-4979-ab57-09074fd55d33`
|
70
|
+
# @param recipient_request
|
71
|
+
# @param [Hash] opts the optional parameters
|
72
|
+
# @return [RecipientResponse]
|
73
|
+
describe 'patch_recipient test' do
|
74
|
+
it 'should work' do
|
75
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,100 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for TransferZero::SendersApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'SendersApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = TransferZero::SendersApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of SendersApi' do
|
30
|
+
it 'should create an instance of SendersApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(TransferZero::SendersApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for delete_sender
|
36
|
+
# Deleting a sender
|
37
|
+
# Deletes a single sender by the Sender ID
|
38
|
+
# @param sender_id ID of the sender to delete. Example: `/v1/senders/bf9ff782-e182-45ac-abea-5bce83ad6670`
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [SenderResponse]
|
41
|
+
describe 'delete_sender test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for get_sender
|
48
|
+
# Fetching a sender
|
49
|
+
# Returns a single sender by the Sender ID
|
50
|
+
# @param sender_id ID of the sender to get. Example: `/v1/senders/bf9ff782-e182-45ac-abea-5bce83ad6670`
|
51
|
+
# @param [Hash] opts the optional parameters
|
52
|
+
# @return [SenderResponse]
|
53
|
+
describe 'get_sender test' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# unit tests for get_senders
|
60
|
+
# Listing senders
|
61
|
+
# Get a list of available senders
|
62
|
+
# @param [Hash] opts the optional parameters
|
63
|
+
# @option opts [Integer] :page The page number to request (defaults to 1)
|
64
|
+
# @option opts [Integer] :per The number of results to load per page (defaults to 10)
|
65
|
+
# @option opts [String] :created_at_from Start date to filter recipients by created_at range Allows filtering results by the specified `created_at` timeframe. Example: `/v1/recipients?created_at_from=2018-06-06&created_at_to=2018-06-08`
|
66
|
+
# @option opts [String] :created_at_to End date to filter recipients by created_at range Allows filtering results by the specified `created_at` timeframe. Example: `/v1/recipients?created_at_from=2018-06-06&created_at_to=2018-06-08`
|
67
|
+
# @option opts [String] :external_id Allows filtering results by `external_id`. Example: `/v1/senders?external_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
|
68
|
+
# @return [SenderListResponse]
|
69
|
+
describe 'get_senders test' do
|
70
|
+
it 'should work' do
|
71
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# unit tests for patch_sender
|
76
|
+
# Updating a sender
|
77
|
+
# Updates the sender specified in the URL path.
|
78
|
+
# @param sender_id ID of the sender to get. Example: `/v1/senders/bf9ff782-e182-45ac-abea-5bce83ad6670`
|
79
|
+
# @param sender_request
|
80
|
+
# @param [Hash] opts the optional parameters
|
81
|
+
# @return [SenderResponse]
|
82
|
+
describe 'patch_sender test' do
|
83
|
+
it 'should work' do
|
84
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
# unit tests for post_senders
|
89
|
+
# Creating a sender
|
90
|
+
# Creates a new sender in our system.
|
91
|
+
# @param sender_request
|
92
|
+
# @param [Hash] opts the optional parameters
|
93
|
+
# @return [SenderResponse]
|
94
|
+
describe 'post_senders test' do
|
95
|
+
it 'should work' do
|
96
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
@@ -0,0 +1,122 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for TransferZero::TransactionsApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'TransactionsApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = TransferZero::TransactionsApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of TransactionsApi' do
|
30
|
+
it 'should create an instance of TransactionsApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(TransferZero::TransactionsApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for calculate_transactions
|
36
|
+
# Calculates transaction amounts for a transaction payload
|
37
|
+
# Calculates the input, output and fee amounts for the recipients in a transaction payload
|
38
|
+
# @param transaction_request
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [TransactionResponse]
|
41
|
+
describe 'calculate_transactions test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for get_transaction
|
48
|
+
# Fetch a single transaction
|
49
|
+
# Finds and returns a Transaction created by the requesting API key, using the provided Transaction ID.
|
50
|
+
# @param transaction_id ID of the transaction. Example: `/v1/transactions/bf9ff782-e182-45ac-abea-5bce83ad6670`
|
51
|
+
# @param [Hash] opts the optional parameters
|
52
|
+
# @return [TransactionResponse]
|
53
|
+
describe 'get_transaction test' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# unit tests for get_transactions
|
60
|
+
# Get a list of transactions
|
61
|
+
# Retrieves a paginated list of the Transactions created by your API key.
|
62
|
+
# @param [Hash] opts the optional parameters
|
63
|
+
# @option opts [Integer] :page The page number to request (defaults to 1)
|
64
|
+
# @option opts [Integer] :per The number of results to load per page (defaults to 10)
|
65
|
+
# @option opts [String] :external_id Allows filtering results by `external_id`. Example: `/v1/senders?external_id=26ec8517-2f0d-48c0-b74f-0bccb9ab3a87`
|
66
|
+
# @return [TransactionListResponse]
|
67
|
+
describe 'get_transactions test' do
|
68
|
+
it 'should work' do
|
69
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# unit tests for payin_transaction
|
74
|
+
# Creates a fake payin for transaction
|
75
|
+
# This method is available only in sandbox environment and is supposed to be used only for testing integration. It allows you to emulate a payin without paying actual money.
|
76
|
+
# @param transaction_id ID of the transaction to payin. Example: `/v1/transactions/bf9ff782-e182-45ac-abea-5bce83ad6670/payin`
|
77
|
+
# @param payin_method_request
|
78
|
+
# @param [Hash] opts the optional parameters
|
79
|
+
# @return [TransactionResponse]
|
80
|
+
describe 'payin_transaction test' do
|
81
|
+
it 'should work' do
|
82
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
# unit tests for payout_transaction
|
87
|
+
# Creates a fake payout for transaction
|
88
|
+
# This method is available only in sandbox environment and is supposed to be used only for testing. It allows you to emulate the payout of a transaction after payin.
|
89
|
+
# @param transaction_id ID of the transaction to payout. Example: `/v1/transactions/bf9ff782-e182-45ac-abea-5bce83ad6670/payout`
|
90
|
+
# @param [Hash] opts the optional parameters
|
91
|
+
# @return [TransactionResponse]
|
92
|
+
describe 'payout_transaction test' do
|
93
|
+
it 'should work' do
|
94
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# unit tests for post_transactions
|
99
|
+
# Creates a new transaction
|
100
|
+
# Transactions are the main objects in the TransferZero API, so it's important to understand how to create and manage them. Transactions facilitate money movement from one Sender in a specific currency to one or multiple Recipients in another currency. The main flow of a successful transaction flow is the following - - Transaction is created linking the Sender to the Recipient(s) with the requested amounts. - Once the sender is KYC'd and approved the transaction can be funded. - Once the transaction is funded, we will initiate the payout to the recipient(s). - After the recipient (or all recipients) has received the money, the transaction is finished.
|
101
|
+
# @param transaction_request
|
102
|
+
# @param [Hash] opts the optional parameters
|
103
|
+
# @return [TransactionResponse]
|
104
|
+
describe 'post_transactions test' do
|
105
|
+
it 'should work' do
|
106
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# unit tests for validate_transactions
|
111
|
+
# Validates a transaction payload
|
112
|
+
# Validates fields in a transaction payload and displays invalid or missing fields
|
113
|
+
# @param transaction_request
|
114
|
+
# @param [Hash] opts the optional parameters
|
115
|
+
# @return [TransactionResponse]
|
116
|
+
describe 'validate_transactions test' do
|
117
|
+
it 'should work' do
|
118
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
@@ -0,0 +1,95 @@
|
|
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 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for TransferZero::WebhooksApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'WebhooksApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = TransferZero::WebhooksApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of WebhooksApi' do
|
30
|
+
it 'should create an instance of WebhooksApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(TransferZero::WebhooksApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for delete_webhook
|
36
|
+
# Unsubscribing from a webhook
|
37
|
+
# Unsubscribes from a webhook specified
|
38
|
+
# @param webhook_id The ID of webhook to cancel. Example: `/v1/webhooks/9d4d7b73-a94c-4979-ab57-09074fd55d33`
|
39
|
+
# @param [Hash] opts the optional parameters
|
40
|
+
# @return [WebhookDefinitionResponse]
|
41
|
+
describe 'delete_webhook test' do
|
42
|
+
it 'should work' do
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# unit tests for get_webhook
|
48
|
+
# Find a webhook's details
|
49
|
+
# Look up a webhook's details with its ID
|
50
|
+
# @param webhook_id The ID of the Webhook to look up Example: `/v1/webhooks/9d4d7b73-a94c-4979-ab57-09074fd55d33`
|
51
|
+
# @param [Hash] opts the optional parameters
|
52
|
+
# @return [WebhookDefinitionResponse]
|
53
|
+
describe 'get_webhook test' do
|
54
|
+
it 'should work' do
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# unit tests for get_webhook_events
|
60
|
+
# Find possible webhook events
|
61
|
+
# Fetching possible webhook events
|
62
|
+
# @param [Hash] opts the optional parameters
|
63
|
+
# @return [WebhookDefinitionEventListResponse]
|
64
|
+
describe 'get_webhook_events test' do
|
65
|
+
it 'should work' do
|
66
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# unit tests for get_webhooks
|
71
|
+
# Listing webhooks
|
72
|
+
# Get a list of created webhooks
|
73
|
+
# @param [Hash] opts the optional parameters
|
74
|
+
# @option opts [Integer] :page The page number to request (defaults to 1)
|
75
|
+
# @option opts [Integer] :per The number of results to load per page (defaults to 10)
|
76
|
+
# @return [WebhookDefinitionListResponse]
|
77
|
+
describe 'get_webhooks test' do
|
78
|
+
it 'should work' do
|
79
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# unit tests for post_webhooks
|
84
|
+
# Creating a webhook
|
85
|
+
# Creates a new webhook, subscribing the provided endpoint to the specified event(s)
|
86
|
+
# @param webhook_definition_request
|
87
|
+
# @param [Hash] opts the optional parameters
|
88
|
+
# @return [WebhookDefinitionResponse]
|
89
|
+
describe 'post_webhooks test' do
|
90
|
+
it 'should work' do
|
91
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
end
|
@@ -0,0 +1,189 @@
|
|
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-beta2
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
|
15
|
+
describe TransferZero::ApiClient do
|
16
|
+
context 'initialization' do
|
17
|
+
context 'URL stuff' do
|
18
|
+
context 'host' do
|
19
|
+
it 'removes http from host' do
|
20
|
+
TransferZero.configure { |c| c.host = 'http://example.com' }
|
21
|
+
expect(TransferZero::Configuration.default.host).to eq('example.com')
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'removes https from host' do
|
25
|
+
TransferZero.configure { |c| c.host = 'https://wookiee.com' }
|
26
|
+
expect(TransferZero::ApiClient.default.config.host).to eq('wookiee.com')
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'removes trailing path from host' do
|
30
|
+
TransferZero.configure { |c| c.host = 'hobo.com/v4' }
|
31
|
+
expect(TransferZero::Configuration.default.host).to eq('hobo.com')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'base_path' do
|
36
|
+
it "prepends a slash to base_path" do
|
37
|
+
TransferZero.configure { |c| c.base_path = 'v4/dog' }
|
38
|
+
expect(TransferZero::Configuration.default.base_path).to eq('/v4/dog')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "doesn't prepend a slash if one is already there" do
|
42
|
+
TransferZero.configure { |c| c.base_path = '/v4/dog' }
|
43
|
+
expect(TransferZero::Configuration.default.base_path).to eq('/v4/dog')
|
44
|
+
end
|
45
|
+
|
46
|
+
it "ends up as a blank string if nil" do
|
47
|
+
TransferZero.configure { |c| c.base_path = nil }
|
48
|
+
expect(TransferZero::Configuration.default.base_path).to eq('')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#deserialize' do
|
55
|
+
it "handles Array<Integer>" do
|
56
|
+
api_client = TransferZero::ApiClient.new
|
57
|
+
headers = { 'Content-Type' => 'application/json' }
|
58
|
+
response = double('response', headers: headers, body: '[12, 34]')
|
59
|
+
data = api_client.deserialize(response, 'Array<Integer>')
|
60
|
+
expect(data).to be_instance_of(Array)
|
61
|
+
expect(data).to eq([12, 34])
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'handles Array<Array<Integer>>' do
|
65
|
+
api_client = TransferZero::ApiClient.new
|
66
|
+
headers = { 'Content-Type' => 'application/json' }
|
67
|
+
response = double('response', headers: headers, body: '[[12, 34], [56]]')
|
68
|
+
data = api_client.deserialize(response, 'Array<Array<Integer>>')
|
69
|
+
expect(data).to be_instance_of(Array)
|
70
|
+
expect(data).to eq([[12, 34], [56]])
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'handles Hash<String, String>' do
|
74
|
+
api_client = TransferZero::ApiClient.new
|
75
|
+
headers = { 'Content-Type' => 'application/json' }
|
76
|
+
response = double('response', headers: headers, body: '{"message": "Hello"}')
|
77
|
+
data = api_client.deserialize(response, 'Hash<String, String>')
|
78
|
+
expect(data).to be_instance_of(Hash)
|
79
|
+
expect(data).to eq(:message => 'Hello')
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe "#object_to_hash" do
|
84
|
+
it 'ignores nils and includes empty arrays' do
|
85
|
+
# uncomment below to test object_to_hash for model
|
86
|
+
# api_client = TransferZero::ApiClient.new
|
87
|
+
# _model = TransferZero::ModelName.new
|
88
|
+
# update the model attribute below
|
89
|
+
# _model.id = 1
|
90
|
+
# update the expected value (hash) below
|
91
|
+
# expected = {id: 1, name: '', tags: []}
|
92
|
+
# expect(api_client.object_to_hash(_model)).to eq(expected)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
describe '#build_collection_param' do
|
97
|
+
let(:param) { ['aa', 'bb', 'cc'] }
|
98
|
+
let(:api_client) { TransferZero::ApiClient.new }
|
99
|
+
|
100
|
+
it 'works for csv' do
|
101
|
+
expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'works for ssv' do
|
105
|
+
expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'works for tsv' do
|
109
|
+
expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'works for pipes' do
|
113
|
+
expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'works for multi' do
|
117
|
+
expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'fails for invalid collection format' do
|
121
|
+
expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
describe '#json_mime?' do
|
126
|
+
let(:api_client) { TransferZero::ApiClient.new }
|
127
|
+
|
128
|
+
it 'works' do
|
129
|
+
expect(api_client.json_mime?(nil)).to eq false
|
130
|
+
expect(api_client.json_mime?('')).to eq false
|
131
|
+
|
132
|
+
expect(api_client.json_mime?('application/json')).to eq true
|
133
|
+
expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
|
134
|
+
expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
|
135
|
+
|
136
|
+
expect(api_client.json_mime?('application/xml')).to eq false
|
137
|
+
expect(api_client.json_mime?('text/plain')).to eq false
|
138
|
+
expect(api_client.json_mime?('application/jsonp')).to eq false
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
describe '#select_header_accept' do
|
143
|
+
let(:api_client) { TransferZero::ApiClient.new }
|
144
|
+
|
145
|
+
it 'works' do
|
146
|
+
expect(api_client.select_header_accept(nil)).to be_nil
|
147
|
+
expect(api_client.select_header_accept([])).to be_nil
|
148
|
+
|
149
|
+
expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
|
150
|
+
expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
151
|
+
expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
152
|
+
|
153
|
+
expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
|
154
|
+
expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe '#select_header_content_type' do
|
159
|
+
let(:api_client) { TransferZero::ApiClient.new }
|
160
|
+
|
161
|
+
it 'works' do
|
162
|
+
expect(api_client.select_header_content_type(nil)).to eq('application/json')
|
163
|
+
expect(api_client.select_header_content_type([])).to eq('application/json')
|
164
|
+
|
165
|
+
expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
|
166
|
+
expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
|
167
|
+
expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
|
168
|
+
expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
|
169
|
+
expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
describe '#sanitize_filename' do
|
174
|
+
let(:api_client) { TransferZero::ApiClient.new }
|
175
|
+
|
176
|
+
it 'works' do
|
177
|
+
expect(api_client.sanitize_filename('sun')).to eq('sun')
|
178
|
+
expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
|
179
|
+
expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
|
180
|
+
expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
|
181
|
+
expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
|
182
|
+
expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
|
183
|
+
expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
|
184
|
+
expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
|
185
|
+
expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|