Giter Club home page Giter Club logo

fintoc-ruby's Introduction

Fintoc meets Ruby

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('sk_test_9c8d8CeyBTx1VcJzuDgpm4H-bywJCeSx')
link = client.get_link('6n12zLmai3lLE9Dq_token_gvEJi8FrBge4fb3cz7Wp856W')
account = link.find(type: 'checking_account')

# Get the las 30 movements
movements = account.get_movements

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

And that’s it!

Documentation

This client supports all Fintoc API endpoints. For complete information about the API, head to the docs.

Examples

Get accounts

require 'fintoc'

client = Fintoc::Client.new('api_key')
link = client.get_link('link_token')
puts link.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 by number
account = link.find(number: '1111111')

# Or by account id
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 DateTime
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')

# You can also set how many movements you want per_page
account.get_movements(since: '2020-01-01', per_page: 100)

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.

fintoc-ruby's People

Contributors

lezorich avatar npcastro avatar sardavend avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fintoc-ruby's Issues

NoMethodError: link.show_accounts

Hola!

La gema tiene un bug al hacer link.show_accounts, retornando lo siguiente:

=> link.show_accounts
NoMethodError: undefined method `plurlize' for Fintoc::Utils:Module
Did you mean?  pluralize

El uso que se le esta dando es el siguiente

fintoc = Fintoc::Client.new(Rails.application.credentials[:fintoc][:api_key])
link = fintoc.get_link(Rails.application.credentials[:fintoc][:bank])
link.show_accounts

Versión de Rails: 6.1.4
Versión de Ruby: 2.7.3

Saludos!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.