Giter Club home page Giter Club logo

ynab.cr's Introduction

ynab

Build Status GitHub license GitHub release

This is an API client for YNAB. It has most of the basic operations for fetching your data from YNAB. See the issues for this project for missing functionality. The primary functionality that still needs implementation is Delta Requests.

Installation

Add this to your application's shard.yml:

dependencies:
  ynab:
    github: jaredsmithse/ynab

Usage

The YNAB API has two base objects, Budget and User. User has no other nested resources, while every other resource is nested under Budget. If you have a budget_id you can initialize the resource you want directly. All available resources are in the ./src/api/ folder.

Examples

Configuration

Instructions for obtaining your own API token can be found on the YNAB website here.

require "ynab"

YNAB::Client.configure do |settings|
  settings.access_token = ynab_api_token
  settings.base_url = "https://api.youneedabudget.com/v1/"
end
client = YNAB::Client

Getting All Budgets For An Account

client = YNAB::Client
budgets = client.budgets.get_all.each do |budget|
  puts budget.name
end

Working With Resources For A Budget

client = YNAB::Client
# Get a list of accounts with a pre-fetched budget_id
budgets = client.budgets.get_all

# you can alternatively do budgets.first.accounts.get_all
accounts = client.accounts(budgets.first.id).get_all
accounts.each { |account| "#{account.name}: $#{account.balance / 100}" }

# Find how many times you use Lyft every month
transactions = budgets.first.transactions.get_all
transactions.
  select { |txn| txn.payee_name == "Lyft" }.
  group_by { |txn| "#{txn.date.year}-#{txn.date.month}" }.
  transform_values(&.size)

Development

For development, you will need a personal access token from YNAB. You can find instructions on how to get one for your account here.

Contributing

  1. Fork it (https://github.com/your-github-user/ynab/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

ynab.cr's People

Contributors

jaredsmithse avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

ynab.cr's Issues

Delta Requests

While building the initial API endpoints we are keeping track of the server knowledge attributes so that we can eventually do paginated requests.

One way to implement this in a clever way is to not expose it, but make the wrappers enumerables and give them each methods so that we can use normal Array-like abilities. Would want to rename them to *Stream or something that informs the user that they are similar but different.

Query Options

For endpoints that support filtering we will want to build a framework for allowing this in the request.

Caching

We should have some internal data tree to cache all of the responses for INDEX requests so that if a user makes that call and then a GET/Show request that we already have, we just return that.

This would need to have some kind of expiration tracking and invalidation marking for when we make a PUT/POST request. Also will need to make available a force option and to update the internal data when we make DELETE requests.

This should be able to be turned off, and maybe disabled by default?

General Code Docs

We have hosted docs but they are currently lacking. Need to add comments for each class with each attribute listed and annotated. This will involve adding :nodoc: where necessary too.

Usage Docs

Will need some example scenarios with usage examples to put into the README.md and the hosted docs (shared). Will need to have a consistent API decided upon by then.

Error Handling

We will need error classes for each type of error returned by YNAB, along with integrating that into the response handling for each endpoint.

This will likely need to be broken down into smaller tasks.

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.