Project

belvo

0.01
The project is in a healthy, maintained state
Belvo is the leading Open Banking API platform in Latin America and the easiest way for users to connect their account to an app
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

Runtime

 Project Readme

Belvo Ruby Gem

Rubygems.org CircleCI (.com) Coveralls github CodeClimate maintainability

📕 Documentation

How to use belvo-ruby: https://belvo-finance.github.io/belvo-ruby/

If you want to check the full documentation about Belvo API: https://docs.belvo.com

Or if you want to more information about:

Installation

Add this line to your application's Gemfile:

gem 'belvo'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install belvo

Usage (create link via widget)

When your user successfully links their account using the Connect Widget, your implemented callback funciton will return the link_id required to make further API to retrieve information.

require 'belvo'

belvo = Belvo::Client.new(
  'your-secret-id',
  'your-secret-password',
  'sandbox'
)

begin
    # Get the link_id from the result of your widget callback function
    link_id = result_from_callback_function.id 
    
    belvo.accounts.retrieve(link: link_id)

    belvo.accounts.list.each do |item|
        puts item
    end
rescue Belvo::RequestError => e
    puts e.status_code
    puts e.detail
end

Usage (create link via SDK)

You can also manually create the link using the SDK. However, for security purposes, we highly recommend, that you use the Connect Widget to create the link and follow the Usage (create link via widget) example.

require 'belvo'

belvo = Belvo::Client.new(
  'your-secret-id',
  'your-secret-password',
  'sandbox'
)

begin
    new_link = belvo.links.register( # Creating the link
        institution: 'erebor_mx_retail', 
        username: 'janedoe', 
        password: 'super-secret',
        options: { access_mode: Belvo::Link::AccessMode::SINGLE }
    )
    
    belvo.accounts.retrieve(link: new_link['id'])

    belvo.accounts.list.each do |item|
        puts item
    end
rescue Belvo::RequestError => e
    puts e.status_code
    puts e.detail
end

Pagination

All list methods only return the first page of results. If you want to iterate by all pages, you will need to specify the page as a parameter:

    #`api/transactions`
    ...
    belvo.transactions.list(params: {page: "2"})
    ...

When the result of your call is nil, this indicates that there are no more pages to iterate over.

Note: If you create a Link without specifying access_mode, the SDK will respect the default value from the API.

Development

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:

  • Create a new branch from master.
  • Update the version number in version.rb
  • Run bundle exec rake install to update Gemfile.lock version
  • Create a new pull request for the new version.
  • Once the new version is merged in master, create a tag matching the new version.

Contributing

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

If you wish to submit a pull request, please be sure check the items on this list:

Code of Conduct

Everyone interacting in the Belvo project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.