/bunq

:bank: A Ruby client for the bunq API.

Primary LanguageRubyMIT LicenseMIT

[WIP] this is a draft.

Bunq

A Ruby client for the bunq API.

Installation

Add this line to your application's Gemfile:

gem 'bunq'

And then execute:

$ bundle

Or install it yourself as:

$ gem install bunq

Usage

Configuration

Bunq.configure do |config|
  config.api_key = '...'
  config.url = 'https://api.bunq.com'
  # config.url = 'https://sandbox.public.api.bunq.com' # Sandbox
  config.version = 'v1'
end

Installation

To create an installation.

# Create keypair
keys = Bunq::KeyPair.generate

client = Bunq::Client.new do |config|
  config.api_key = '...'
  config.private_key = keys.private_key
end

# Create installation
installation = client.installations.create(keys.public_key)

# Configure installation
client.installation_token = installation.token
client.server_public_key = installation.server_public_key

Basic usage

client = Bunq::Client.new do |config|
  config.api_key = '...'
  config.private_key = keys.private_key 
  config.installation_token = '...'
  config.server_public_key = '...'
end

Device server

To create a device server.

device_server = client.device_servers.create("My server")
device_server.id

Session server

To create a session server.

session_server = client.session_servers.create
session_server.token

User

Get a list of all available users.

users = client.users.list

Get a specific user.

user = client.users.get(1)

Monetary account bank

Get a list of monetary account bank for a given user.

user = client.users.get(1)
monetary_accounts = user.monetary_account_bank.list

Payment

Get a list of all payments done for a given monetary account.

user = client.users.get(1)
monetary_account = user.monetary_account_bank.get(1)
payments = monetary_account.payments.list type: "IDEAL"

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/BeginRescue/bunq. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.