Ruby interface to Tide's bank RESTful API.
Table of contents
- Obtaining an Authorization Grant Code
- Exchanging an Authorisation Grant for an Access Token
- Fetching Companies
- Fetching Accounts
- Fetching Transactions
- Code of Conduct
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install tide-api
Access Tokens to allow access to the API via OAuth 2. Tide uses
Access Tokens to allow access to the
API via OAuth 2. You can obtain an OAuth 2
Access Token by navigating to the below url, either in the web application
or through an in-app browser window:
||string||Fully qualified URL to which
||string||Unique identifier for the requester.|
Once the page loads, the user needs to enter the unique email address, which is registered on their Tide account.
Obtaining an Authorization Grant Code
Use the bundled minimalistic AuthServer to automate the process above:
require 'tide/api' require 'tide/api/auth_server' server = Tide::API::AuthServer.new auth_grant_code = server.run
Authorisation Grants can only be used once off by the client, once used they are expired and cannot be used to issue
Exchanging an Authorisation Grant for an Access Token
Exchange the authorisation grant code with the method
client = Tide::API::Client.new tokens = client.fetch_tokens(auth_grant_code) # Tokens contains an access token and a refresh token tokens.access_token tokens.refresh_token
fetch_tokens will configure the client behind the scenes to make authenticated requests.
This method retrieves a collection of companies with the user. The user is determined from authorization header.
companies = client.fetch_companies
This method retrieves a collection of company accounts associated with the user. The user is determined from authorization header.
accounts = client.fetch_accounts(companies.first.id)
This method retrieves a collection of an account's transactions:
transactions = client.fetch_transactions(accounts.first.id)
After checking out the repo, run
bin/setup to install dependencies, configure git hooks and create support files.
You can also run
bin/console for an interactive prompt that will allow you to experiment.
The health and maintainability of the codebase is ensured through a set of Rake tasks to test, lint and audit the gem for security vulnerabilities and documentation:
rake bundle:audit # Checks for vulnerable versions of gems rake qa # Test, lint and perform security and documentation audits rake rubocop # Lint the codebase with RuboCop rake rubocop:auto_correct # Auto-correct RuboCop offenses rake spec # Run RSpec code examples rake verify_measurements # Verify that yardstick coverage is at least 100% rake yard # Generate YARD Documentation rake yard:junk # Check the junk in your YARD Documentation rake yardstick_measure # Measure docs in lib/**/*.rb with yardstick
Bug reports and pull requests are welcome on GitHub at https://github.com/wilsonsilva/tide-api. 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.
Code of Conduct
Everyone interacting in the Tide::API project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.