Skip to content

Instantly share code, notes, and snippets.

View tmornini's full-sized avatar

Tom Mornini tmornini

View GitHub Profile
@tmornini
tmornini / gist:789d0cf3bccec2cdcf2c
Last active August 29, 2015 14:03
Subledger Getting Started
0) Live in-browser API docs (Swagger)
a) https://api.subledger.com
b) we recommend that you copy/paste all responses for future reference
1) Setup the system
a) Create an Identity via first API operation!
b) Enter key_id and secret in the Security credentials boxes in the upper-right corner of API docs
c) Create an org
d) Create a book
e) Create some accounts (Recommended: Cash, Payables, Shareholder Equity)
Q) What is Subledger?
A) Subledger is a modern double-entry ledger and financial report API for mobile and web app developers.
Q) What is Subledger's purpose?
A) Subledger's purpose is to give developers the tools to maintain more accurate, detailed and actionable
financial information than they would if they built it themselves.
Q) Is Subledger difficult to use?
A) No. It is easier, less expensive and less risky than building something equivalent. Subledger customers have greatly
simplified their code bases, reduced their operational responsibility, and reduced the latency and complexity of their
@tmornini
tmornini / gist:10551841
Last active November 24, 2015 19:04
Subledger v2 create_and_post JSON body
{
"effective_at": "ISO8601 Date/Time",
"description": "Free form text",
"reference": "URL",
"lines": [
{
"account": "account_id",
"value": {
"type": "debit",
"amount": "10.00"
E, [2014-04-06T12:10:05.837299 #58542] ERROR -- : MyServer crashed!
Reel::StateError: already processing a request
require 'uri'
require 'reel'
require 'subledger/json'
require 'subledger/uuid'
module Subledger
module Server
class Reel < Reel::Server::HTTP
@tmornini
tmornini / 2.0.0-p451
Last active August 29, 2015 13:57
Segfault in Ruby 2.1.0 and 2.1.1, Mac OS X 10.9.2
ruby: 2.0.0-p451 | master *%
v3 $ ./example.rb
./example.rb:14:in `<module:Subledger>': Subledger::BadRequest
from ./example.rb:3:in `<main>'
With single satoshi addresses
-----------------------------
Top 100%
---------------------------------------------------------------------------------------------------
| Total | Percentage | Average | Min | Max |
---------------------------------------------------------------------------------------------------
| 0.00216157 | 0.00000002 | 0.00000001 | 0.00000001 | 0.00000001 |
| 0.00253359 | 0.00000002 | 0.00000001 | 0.00000001 | 0.00000004 |
| 0.04517230 | 0.00000037 | 0.00000021 | 0.00000004 | 0.00000039 |
irb(main):011:0> [1][0..-1]
=> [1] # makes sense
irb(main):012:0> [1][1..-1]
=> [] # WTF?
irb(main):013:0> [1][2..-1]
=> nil # makes sense
@tmornini
tmornini / balance sheet
Created October 2, 2013 06:56
Subledger's first balance sheet and income statement, based upon Sam Carpenter's original demo app. One transaction in, the company has a $513 profit! :-) But where in the world is the report's description? :-(
{
"id": "TqNGddkj4zU84KGjf5eYq2",
"book": "hTEokfDKuFi0EdSEOuUE14",
"report": "KdYr7C7ySmdohI7Bo7Z3H3",
"effective_at": "2013-10-02T06:22:08Z",
"total_accounts": 12,
"progress": {
"percentage": 100
},
"rendered_at": "2013-10-02T06:22:08.798Z",
# unauthenticated client
client = Subledger.new
identity_args = { :description => '',
:email => '' }
identity, key = client.
identities.
create identity_args