Ruby interface to Tide's bank RESTful API.
Add this line to your application's Gemfile:
gem 'tide-api'
And then execute:
$ bundle
Or install it yourself as:
$ gem install tide-api
Tide uses Access Tokens
to allow access to the API via OAuth 2. Tide uses Access Token
s to allow access to the
API via OAuth 2. You can obtain an OAuth 2 Access Toke
n by navigating to the below url, either in the web application
or through an in-app browser window:
https://api.tide.co/tide-backend/oauth/index.html?redirect_url={url}&client_id={unique_id}
Parameter | Type | Description |
---|---|---|
redirect_uri |
string | Fully qualified URL to which Authorisation Grants will be delivered to. Grants will be delivered only on successful authorisation by resource owner. |
client_id |
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.
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
new Access Tokens
.
Exchange the authorisation grant code with the method fetch_tokens
:
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
The method 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.
Everyone interacting in the Tide::API project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.