# Codat [![Gem Version](https://badge.fury.io/rb/codat.svg)](https://badge.fury.io/rb/codat) A simple wrapper for the [Codat](https://www.codat.io/) API. Please refer to Codat's documentation to complement any information you need: * [Codat API reference](https://docs.codat.io/) * [Codat API explorer](https://api-uat.codat.io/swagger/ui/index) (to use this you need to have access to the UAT portal). ## Installation Add this line to your application's Gemfile: ```ruby gem 'codat' ``` And then execute: $ bundle Or install it yourself as: $ gem install codat ## Usage ### Bank bankAccounts To get a list of bank accounts: ```ruby BankAccount.all(company_id: 'a49b891d-a593-43aa-bb82-0d8b108eb3ac') # => [] ``` ### Financial reports To get a financial report - profit & loss: ```ruby ProfitAndLoss.find( company_id: 'a49b891d-a593-43aa-bb82-0d8b108eb3ac', period_length: 12, periods_to_compare: 2 ) # => [] ``` To get a financial report - balance sheet: ```ruby BalanceSheet.find( company_id: 'a49b891d-a593-43aa-bb82-0d8b108eb3ac', period_length: 12, periods_to_compare: 2 ) ``` ### Companies To get a list of companies (paginated): ```ruby Company.all(page: 1) # => [] ``` To create a company: ```ruby Company.create(name: 'company name') # => {} ``` ### Report To get a list of reports for aged debtor: ```ruby list = Report.all(company_id: 'a49b891d-a593-43aa-bb82-0d8b108eb3ac') # => [] ``` ### BankStatement To get a list of bank statements: ```ruby list = BankStatement.all(company_id: 'a49b891d-a593-43aa-bb82-0d8b108eb3ac') # => [] ``` ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` 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](https://rubygems.org). ## Contributing Bug reports and pull requests are welcome on GitHub at https://gitlab.com/finpoint/codat. ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).