Add this line to your application's Gemfile:
gem 'bunq_rb'And then execute:
$ bundle
Or install it yourself as:
$ gem install bunq_rb
First configure the gem
BunqRb.configure do |config|
config.api_key = ENV.fetch("API_KEY")
config.key = key # OpenSSL::PKey::RSA.new 2048
config.url = "https://sandbox.public.api.bunq.com"
config.page_size = 200
end
https://github.com/ahtung/bunq_rb/blob/feature/readme/spec/scenarios/create_session_spec.rb
https://github.com/ahtung/bunq_rb/blob/feature/readme/spec/scenarios/make_a_payment_request_spec.rb
https://github.com/ahtung/bunq_rb/blob/feature/readme/spec/scenarios/creating_a_tab_payment_spec.rb
installation, token, server_public_key = BunqRb::Installation.create(client_public_key: BunqRb.configuration.key.public_key)installation = BunqRb::Installation.find(2348)installations = BunqRb::Installation.allinstallation = BunqRb::Installation.find(2348)
server_public_key = installation.server_public_keydevice = BunqRb::Device.find(2348)devices = BunqRb::Device.alldevice_server = BunqRb::DeviceServer.create(
description: "Dunya",
secret: BunqRb.configuration.api_key,
permitted_ips: []
)device_server = BunqRb::DeviceServer.find(1434035)device_servers = BunqRb::DeviceServer.alluser_id = 1
credential_password_id = 11
permitted_ip_id = 42
device_servers = BunqRb::PermittedIp.find(user_id, credential_password_id, permitted_ip_id)user_id = 1
credential_password_id = 11
device_servers = BunqRb::PermittedIp.all(user_id, credential_password_id)TODO
TODO
TODO
TODO
TODO
TODO
TODO
user = BunqRb::User.find(1)
monetary_account = user.monetary_accounts.first
payments = monetary_account.paymentsTODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
user_id = 1
monetary_account_id = 1933
bunq_me_tabs = BunqRb::BunqMeTab.all(user_id, monetary_account_id)
# OR
user = BunqRb::User.find(1)
monetary_accounts = user.monetary_accounts
bunq_me_tabs = monetary_accounts.first.bunq_me_tabsTODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
user = BunqRb::User.find(1)users = BunqRb::User.allTODO
TODO
TODO
TODO
TODO
user = BunqRb::User.find(1)
monetary_accounts = user.monetary_accountsTODO
TODO
TODO
TODO
TODO
TODO
user_id = 1
monetary_account_id = 11
cash_register_id = 42
cash_registers = BunqRb::CashRegister.find(user_id, monetary_account_id, cash_register_id)user_id = 1
monetary_account_id = 11
cash_registers = BunqRb::CashRegister.all(user_id, monetary_account_id)TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
user_id = 1
card_id = 82082
card = BunqRb::Card.find(user_id, card_id)user_id = 1
cards = BunqRb::Card.all(user_id)
# OR
user = BunqRb::User.find(1)
cards = user.cardsTODO
user_id = 1
cards = BunqRb::CardName.all(user_id)
# OR
user = BunqRb::User.find(1)
cards = user.card_namesTODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
avatar = BunqRb::Avatar.create(
attachment_public_uuid: "d93e07e3-d420-45e5-8684-fc0c09a63686"
)avatar = BunqRb::Avatar.find(1019)image_path = File.expand_path(File.join(File.dirname(__FILE__), "../fixtures/images/baz.jpg"))
image = Faraday::UploadIO.new(image_path, 'image/jpeg')
attachment = BunqRb::AttachmentPublic.create(image)avatar = BunqRb::AttachmentPublic.find(1019)TODO
image_path = File.expand_path(File.join(File.dirname(__FILE__), "../fixtures/images/baz.jpg"))
image = Faraday::UploadIO.new(image_path, 'image/jpeg')
attachment = BunqRb::AttachmentMonetaryAccount.create(image)TODO
TODO
TODO
TODO
TODO
TODO
TODO
TODO
user_id = 1
monetary_account_id = 11
invoice = BunqRb::Invoice.find(user_id, monetary_account_id, 42)user_id = 1
monetary_account_id = 11
invoices = BunqRb::Invoice.all(user_id, monetary_account_id)user_id = 1
invoice = BunqRb::InvoiceByUser.find(user_id, 42)user_id = 1
invoices = BunqRb::InvoiceByUser.all(user_id)TODO
user_id = 1
monetary_account_id = 11
invoice = BunqRb::CustomerStatementExport.find(user_id, monetary_account_id, 42)user_id = 1
monetary_account_id = 11
invoices = BunqRb::CustomerStatementExport.all(user_id, monetary_account_id)user_id = 1
monetary_account_id = 11
invoice = BunqRb::CustomerStatementExport.delete(user_id, monetary_account_id, 42)TODO
TODO
user_id = 1
invoice = BunqRb::ExportAnnualOverview.find(user_id, 42)user_id = 1
invoices = BunqRb::ExportAnnualOverview.all(user_id)TODO
After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/ahtung/bunq_rb. 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.
The gem is available as open source under the terms of the MIT License.