transferzero-sdk

TransferZero - the Ruby gem for the TransferZero API

Reference documentation for the TransferZero API V1

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.0
  • Package version: 1.15.1
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen

For more information, please visit:

Installation

Build a gem

To build the Ruby code into a gem:

shell gem build transferzero-sdk.gemspec

Then either install the gem locally:

shell gem install ./transferzero-sdk-1.15.1.gem (for development, run gem install --dev ./transferzero-sdk-1.15.1.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'transferzero-sdk', '~> 1.15.1'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/transferzero/transferzero-sdk-ruby, then add the following in the Gemfile:

gem 'transferzero-sdk', :git => 'https://github.com/transferzero/transferzero-sdk-ruby.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

shell ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

Webhooks

To parse webhooks you can use the following snippet: ```ruby webhook_content = “{ webhook content from endpoint }”

url = “"

headers = { “Authorization-Nonce”: “", "Authorization-Key": "", "Authorization-Signature": "" } webhook_api = TransferZero::ApiClient.new

if webhook_api.validate_webhook_request(webhook_url, webhook_content, headers) webhook = webhook_api.parse_response(webhook_content, “Webhook”)

if webhook[‘event’].start_with?(‘transaction’) transaction_webhook = webhook_api.parse_response(webhook_content, ‘TransactionWebhook’) puts transaction_webhook.object.to_s elsif webhook[‘event’].start_with?(‘recipient’) recipient_webhook = webhook_api.parse_response(webhook_content, ‘RecipientWebhook’) puts recipient_webhook.object.to_s elsif webhook[‘event’].start_with?(‘payout_method’) payout_method_webhook = webhook_api.parse_response(webhook_content, ‘PayoutMethodWebhook’) puts payout_method_webhook.object.to_s elsif webhook[‘event’].start_with?(‘sender’) sender_webhook = webhook_api.parse_response(webhook_content, ‘SenderWebhook’) puts sender_webhook.object.to_s elsif webhook[‘event’].start_with?(‘document’) document_webhook = webhook_api.parse_response(webhook_content, ‘DocumentWebhook’) puts document_webhook.object.to_s else puts webhook end end ```

Documentation for API Endpoints

All URIs are relative to https://api-sandbox.transferzero.com/v1

Class Method HTTP request Description
TransferZero::APILogsApi get_api_log GET /api_logs/Log ID Fetch an individual API log
TransferZero::APILogsApi get_api_logs GET /api_logs Fetch a list of API logs
TransferZero::AccountDebitsApi get_accounts_debit GET /accounts/debits/Debit ID Fetching an account debit
TransferZero::AccountDebitsApi get_accounts_debits GET /accounts/debits Listing Accounts debits
TransferZero::AccountDebitsApi post_accounts_debits POST /accounts/debits Creating an account debit
TransferZero::AccountValidationApi post_account_validations POST /account_validations Validates the existence of a bank account or a mobile phone number
TransferZero::AccountsApi get_account GET /accounts/Currency Fetches account balance for specified currrency
TransferZero::AccountsApi get_accounts GET /accounts Fetches account balances for all currencies
TransferZero::CurrencyInfoApi info_currencies GET /info/currencies Getting a list of possible requested currencies
TransferZero::CurrencyInfoApi info_currencies_in GET /info/currencies/in Getting a list of possible input currencies
TransferZero::CurrencyInfoApi info_currencies_out GET /info/currencies/out Getting a list of possible output currencies
TransferZero::DocumentsApi get_document GET /documents/ID Fetching a document
TransferZero::DocumentsApi get_documents GET /documents Getting a list of documents
TransferZero::DocumentsApi post_documents POST /documents Creating a document
TransferZero::LogsApi get_webhook_log GET /logs/Log ID Fetch an individual webhook log
TransferZero::LogsApi get_webhook_logs GET /logs/webhooks Fetch a list of webhook logs
TransferZero::PaymentMethodsApi payment_methods_in GET /info/payment_methods/in This method returns possible payin methods.
TransferZero::PaymentMethodsApi payment_methods_out GET /info/payment_methods/out This method returns possible payout methods.
TransferZero::PayoutMethodsApi delete_payout_method DELETE /payout_methods/Method ID Deleting a payout method
TransferZero::PayoutMethodsApi get_payout_method GET /payout_methods/Method ID Fetching a payout method
TransferZero::PayoutMethodsApi get_payout_methods GET /payout_methods Listing payout methods
TransferZero::PayoutMethodsApi patch_payout_method PATCH /payout_methods/Method ID Updating a payout method
TransferZero::PayoutMethodsApi post_payout_methods POST /payout_methods Creating a payout method
TransferZero::RecipientsApi delete_recipient DELETE /recipients/ID Cancelling a recipient
TransferZero::RecipientsApi get_recipients GET /recipients Getting a list of recipients with filtering
TransferZero::RecipientsApi patch_recipient PATCH /recipients/ID Updating a recipient
TransferZero::RecipientsApi proof_of_payments GET /recipients/ID/proof_of_payments Returns list of proof of payments
TransferZero::SendersApi delete_sender DELETE /senders/ID Deleting a sender
TransferZero::SendersApi get_sender GET /senders/ID Fetching a sender
TransferZero::SendersApi get_senders GET /senders Listing senders
TransferZero::SendersApi patch_sender PATCH /senders/ID Updating a sender
TransferZero::SendersApi post_senders POST /senders Creating a sender
TransferZero::TransactionsApi calculate_transactions POST /transactions/calculate Calculates transaction amounts for a transaction payload
TransferZero::TransactionsApi create_and_fund_transaction POST /transactions/create_and_fund Creates a new transaction and funds it from account balance
TransferZero::TransactionsApi get_transaction GET /transactions/ID Fetch a single transaction
TransferZero::TransactionsApi get_transactions GET /transactions Get a list of transactions
TransferZero::TransactionsApi payin_transaction POST /transactions/ID/payin Creates a fake payin for transaction
TransferZero::TransactionsApi payout_transaction POST /transactions/ID/payout Creates a fake payout for transaction
TransferZero::TransactionsApi post_transactions POST /transactions Creates a new transaction
TransferZero::TransactionsApi validate_transactions POST /transactions/validate Validates a transaction payload
TransferZero::WebhooksApi delete_webhook DELETE /webhooks/ID Unsubscribing from a webhook
TransferZero::WebhooksApi get_webhook GET /webhooks/ID Find a webhook’s details
TransferZero::WebhooksApi get_webhook_events GET /webhooks/events Find possible webhook events
TransferZero::WebhooksApi get_webhooks GET /webhooks Listing webhooks
TransferZero::WebhooksApi post_webhooks POST /webhooks Creating a webhook

Documentation for Models

Documentation for Authorization

You can set the API Key and Secret on the ApiClient object for authentication:

```ruby # Load the gem require ‘transferzero’

Setup authorization

TransferZero.configure do |config| config.api_key = ‘YOUR API KEY’ config.api_secret = ‘YOUR API SECRET’ config.host = “https://api-sandbox.transferzero.com/v1” end

begin request = TransferZero::AccountValidationRequest.new # account validation api request.bank_account = ‘9040004458219’ request.bank_code = ‘020100’ request.country = ‘GH’ request.currency = ‘GHS’ request.method = ‘bank’

avi = TransferZero::AccountValidationApi.new account_validation = avi.post_account_validations(request) account_name = account_validation.object.account_name puts “Account Name: #account_name” rescue TransferZero::ApiError => e if e.validation_error puts e.response_object(“AccountValidationResponse”).meta.error else puts “Exception when calling AccountValidationApi#account_validation_example: #e” end end ```