Bases: builtins.object
Bases: flask.json.JSONDecoder
Bases: flask.json.JSONEncoder
This module contains the high-level webservice logic such as the Flask setup and the Flask endpoints.
flask.Flask.before_request()-decorated method that initializes an accounting.Ledger object.
Returns the JSON-serialized output of accounting.Ledger.reg()
REST/JSON endpoint for transactions.
Current state:
Takes a POST request with a transactions JSON payload and writes it to the ledger file.
Requires the transactions payload to be __type__-annotated:
{
"transactions": [
{
"__type__": "Transaction",
"date": "2013-01-01",
"payee": "Kindly T. Donor",
"postings": [
{
"__type__": "Posting",
"account": "Income:Foo:Donation",
"amount": {
"__type__": "Amount",
"amount": "-100",
"symbol": "$"
}
},
{
"__type__": "Posting",
"account": "Assets:Checking",
"amount": {
"__type__": "Amount",
"amount": "100",
"symbol": "$"
}
}
]
}
}
becomes:
2013-01-01 Kindly T. Donor
Income:Foo:Donation $ -100
Assets:Checking $ 100