Git Product home page Git Product logo

banks_api's Introduction

Banks API

Usage

Authentication

require "banks_api-bankname"

user_account = BanksApi::UserAccount.new(
  "bankname",
  credential_hash
)

Fetching accounts information

A user's account in a bank may have access to multiple bank accounts.

bank_accounts = user_account.bank_accounts
puts bank_accounts.first.inspect
#<BanksApi::BankName::BankAccount
  id: "1234567890",
  description: "...",
  balance: #<Money fractional:987654 currency:JPY>
>

Fetching transactions for a specific bank account

transactions = bank_accounts.first.transactions(
  from: Date.today.prev_month,
  to: Date.today
)
puts transactions.first.inspect
#<BanksApi::BankName::Transaction
  date: #<Date: 2018-09-25 ((2458387j,0s,0n),+0s,2299161j)>,
  description: "a description of the transaction",
  amount: #<Money fractional:200 currency:JPY>
>

Project

Classes

Bank (unnecessary?)

Specific bank classes (eg. ShinseiBank) inherit from this. (Maybe using duck-typing is enough?)

UserAccount

This represents a user account in a specific bank, with its credentials.

attr_accessor :bank           # Class? Symbol?
attr_accessor :credentials    # Hash? CredentialSet?
has_many :bank_accounts, class_name: "BankAccount"

BankAccount

A bank account that has a balance and a list of transactions. (There may be multiple bank accounts in a unique user account.)

attr_accessor :name           # String
attr_accessor :balance        # Money?
has_many :transactions, class_name: "Transaction"

Transaction

A credit or a debit transaction, with an amount, a date and a description. (How about a payee, only on the YNAB side?)

attr_accessor :type           # Symbol? (:credit, :debit)
attr_accessor :amount         # Money?
attr_accessor :description    # String
attr_accessor :date           # Date

gems

Base gem (banks_api)

Provides:

  • coding guidelines
  • public API
  • basic Bank class?

Command-line gem (banks_api-cli)

Provides:

  • command-line tool (with Thor?)

Specific bank gem (eg. banks_api-shinsei)

Implements:

  • user credential format (Hash or custom class?)
  • list accounts
  • getting balance per account
  • getting transactions per account
  • transfering money?

Sync gem (banks_api-ynab)

Takes a BankAccount and syncs its transactions with a specific account in a budget.

gem README

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file lib/banks_api. To experiment with that code, run bin/console for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

Installation

Add this line to your application's Gemfile:

gem 'banks_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install banks_api

Usage

TODO: Write usage instructions here

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test 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, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/banks_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.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

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

banks_api's People

Contributors

davidstosik avatar

Watchers

 avatar

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.