Skip to content
TransferZero SDK for Ruby
Ruby Shell
Branch: master
Clone or download
Travis CI
Travis CI BTA-1840 [XOF:Payout:Bank & BRM] - 7. Update API documentation, API S…
…pec and SDKs (#128)

* Updated payout_method.yaml with XOF::Bank specs

* Corrected wrong indentation

* Added mention about initial Beta phase

https://btcafrica.atlassian.net/browse/BTA-1840
Latest commit f51c149 Aug 14, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.openapi-generator
.swagger-codegen TransferZero SDK 1.0.0 May 16, 2019
docs BTA-1840 [XOF:Payout:Bank & BRM] - 7. Update API documentation, API S… Aug 14, 2019
example TransferZero SDK 1.0.0 May 16, 2019
lib BTA-1840 [XOF:Payout:Bank & BRM] - 7. Update API documentation, API S… Aug 14, 2019
spec
.gitignore TransferZero SDK 1.0.0 May 16, 2019
.openapi-generator-ignore
.rspec TransferZero SDK 1.0.0 May 16, 2019
.rubocop.yml TransferZero SDK 1.0.0 May 16, 2019
.travis.yml BTA-2070-update-ruby-sdk-versions-to-1.3.0) (#129) Aug 14, 2019
Gemfile
LICENSE TransferZero SDK 1.0.0 May 16, 2019
README.md BTA-1840 [XOF:Payout:Bank & BRM] - 7. Update API documentation, API S… Aug 14, 2019
Rakefile
git_push.sh TransferZero SDK 1.0.0 May 16, 2019
transferzero-sdk.gemspec TransferZero SDK 1.0.0 May 16, 2019

README.md

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.3.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen

For more information, please visit:

Installation

Build a gem

To build the Ruby code into a gem:

gem build transferzero-sdk.gemspec

Then either install the gem locally:

gem install ./transferzero-sdk-1.3.0.gem

(for development, run gem install --dev ./transferzero-sdk-1.3.0.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.3.0'

Install from Git

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

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

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

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:

webhook_content = "{ webhook content from endpoint }"

url = "<url from webhook headers>"

headers = {
  "Authorization-Nonce": "<nonce from webhook headers>",
  "Authorization-Key": "<key from webhook headers>",
  "Authorization-Signature": "<signature from webhook headers>"
}
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/{API 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/{Account 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
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/{Document 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/{Webhook 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/{Payout Method ID} Deleting a payout method
TransferZero::PayoutMethodsApi get_payout_method GET /payout_methods/{Payout 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/{Payout Method ID} Updating a payout method
TransferZero::PayoutMethodsApi post_payout_methods POST /payout_methods Creating a payout method
TransferZero::RecipientsApi delete_recipient DELETE /recipients/{Recipient ID} Cancelling a recipient
TransferZero::RecipientsApi get_recipients GET /recipients Getting a list of recipients with filtering
TransferZero::RecipientsApi patch_recipient PATCH /recipients/{Recipient ID} Updating a recipient
TransferZero::SendersApi delete_sender DELETE /senders/{Sender ID} Deleting a sender
TransferZero::SendersApi get_sender GET /senders/{Sender ID} Fetching a sender
TransferZero::SendersApi get_senders GET /senders Listing senders
TransferZero::SendersApi patch_sender PATCH /senders/{Sender 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 get_transaction GET /transactions/{Transaction ID} Fetch a single transaction
TransferZero::TransactionsApi get_transactions GET /transactions Get a list of transactions
TransferZero::TransactionsApi payin_transaction POST /transactions/{Transaction ID}/payin Creates a fake payin for transaction
TransferZero::TransactionsApi payout_transaction POST /transactions/{Transaction 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/{Webhook ID} Unsubscribing from a webhook
TransferZero::WebhooksApi get_webhook GET /webhooks/{Webhook 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:

# 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
You can’t perform that action at this time.