sardavend / fintoc-ruby

The official Ruby client for the Fintoc API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fintoc

Fintoc meets Ruby

Version Try on RunKit

You have just found the Ruby-flavored client of Fintoc. It mainly consists of a port (more of a carbon copy, really) of fintoc-python.

Why?

You can think of Fintoc API as a piscola. And the key ingredient to a properly made piscola are the ice cubes.
Sure, you can still have a piscola without ice cubes. But hey… that’s not enjoyable -- why would you do that?
Do yourself a favor: go grab some ice cubes by installing this refreshing library.

Table of contents

How to Install

Add this line to your application's Gemfile:

gem 'fintoc'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install fintoc

Quickstart

  1. Get your API key and link your bank account using the Fintoc dashboard.
  2. Open your command-line interface.
  3. Write a few lines of Ruby code to see your bank movements.
require 'fintoc'

client = Fintoc::Client.new('api_key')
link = client.link('link_token')
account = link.find(type: 'checking_account')

#Get the las 30 movements
movements = account.get_movements

#Or get the all the movements since 
movements = account.get_movements(since: '2020-08-15')

And that’s it!

Documentation

Examples

Get accounts

require 'fintoc'

client = Fintoc::Client.new('api_key')
link = client.get_link('link_token')
accounts = link.get_accounts
puts accounts

# Or... you can pretty print all the accounts in a Link

link = client.get_link('link_token')
link.show_accounts

If you want to find a specific account in a link, you can use find. You can search by any account field:

require 'fintoc'

client = Fintoc::Client.new('api_key')
link = client.get_link('link_token')
account = link.find(type: 'checking_account')

# or 
account = link.find(number: '1111111')

# or

account = link.find(id: 'sdfsdf234')

You can also search for multiple accounts matching a specific criteria with find_all:

require 'fintoc'

client = Fintoc::Client.new('api_key')
link = client.get_link('link_token')
accounts = link.find_all(currency: 'CLP')

To update the account balance you can use update_balance:

require 'fintoc'

client = Fintoc::Client.new('api_key')
link = client.get_link('link_token')
account = link.find(number: '1111111')
account.update_balance

Get movements

require 'fintoc'
require 'time'

client = Fintoc::Client.new('api_key')
link = client.get_link('link_token')
account = link.find(type: 'checking_account')

# You can get the account movements since a specific Date
yesterday = DateTime.now - 1
account.get_movements(since: yesterday)

# Or... you can use an ISO 8601 formatted string representation of the Date
account.get_movements(since: '2020-01-01')

Calling get_movements without arguments gets the last 30 movements of the account

Dependencies

This project relies on the following packages:

How to test…

You can run all the tests just by running:

rspec

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/fintoc-com/fintoc.

About

The official Ruby client for the Fintoc API

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Ruby 99.5%Language:Shell 0.5%