diff --git a/README.md b/README.md
index 7db96bf..cba64d6 100644
--- a/README.md
+++ b/README.md
@@ -69,6 +69,10 @@ print(invoice.due_on)
Returns `Account` instance. Account is readonly and can't be updated by API.
+Fakturoid.bank_accounts()
+
+Returns list of `BankAccount` instances. Bank accounts are readonly and can't be updated by API.
+
Fakturoid.subject(id)
Returns `Subject` instance.
@@ -147,6 +151,10 @@ Values are mapped to corresponding `int`, `decimal.Decimal`, `datetime.date` and
[http://docs.fakturoid.apiary.io/#reference/account](http://docs.fakturoid.apiary.io/#reference/account)
+Fakturoid.BankAccount
+
+[http://docs.fakturoid.apiary.io/#reference/bank-accounts](http://docs.fakturoid.apiary.io/#reference/bank-accounts)
+
Fakturoid.Subject
[http://docs.fakturoid.apiary.io/#reference/subjects](http://docs.fakturoid.apiary.io/#reference/subjects)
diff --git a/fakturoid/api.py b/fakturoid/api.py
index 9b7201d..55c4056 100644
--- a/fakturoid/api.py
+++ b/fakturoid/api.py
@@ -5,7 +5,7 @@
import requests
-from fakturoid.models import Account, Subject, Invoice, Generator, Message
+from fakturoid.models import Account, Subject, Invoice, Generator, Message, BankAccount
from fakturoid.paging import ModelList
__all__ = ['Fakturoid']
@@ -29,6 +29,7 @@ def __init__(self, slug, email, api_key, user_agent=None):
self._models_api = {
Account: AccountApi(self),
+ BankAccount: BankAccountsApi(self),
Subject: SubjectsApi(self),
Invoice: InvoicesApi(self),
Generator: GeneratorsApi(self),
@@ -63,6 +64,9 @@ def wrapper(self, *args, **kwargs):
def account(self):
return self._models_api[Account].load()
+ def bank_accounts(self):
+ return self._models_api[BankAccount].find()
+
@model_api(Subject)
def subject(self, mapi, id):
return mapi.load(id)
@@ -213,6 +217,15 @@ def load(self):
return self.unpack(response)
+class BankAccountsApi(ModelApi):
+ model_type = BankAccount
+ endpoint = 'bank_accounts'
+
+ def find(self, params={}, endpoint=None):
+ response = self.session._get(endpoint or self.endpoint, params=params)
+ return self.unpack(response)
+
+
class SubjectsApi(CrudModelApi):
model_type = Subject
endpoint = 'subjects'
diff --git a/fakturoid/models.py b/fakturoid/models.py
index d5954ed..7e1da84 100644
--- a/fakturoid/models.py
+++ b/fakturoid/models.py
@@ -5,7 +5,7 @@
from fakturoid import six
-__all__ = ['Account', 'Subject', 'InvoiceLine', 'Invoice', 'Generator', 'Message']
+__all__ = ['Account', 'BankAccount', 'Subject', 'InvoiceLine', 'Invoice', 'Generator', 'Message']
class Model(six.UnicodeMixin):
@@ -72,6 +72,20 @@ def __repr__(self):
return "<{0}:{1}>".format(self.__class__.__name__, self.name)
+class BankAccount(Model):
+ """See http://docs.fakturoid.apiary.io/ for complete field reference."""
+ name = None
+
+ class Meta:
+ decimal = []
+
+ def __unicode__(self):
+ return self.name
+
+ def __repr__(self):
+ return "<{0}:{1}>".format(self.__class__.__name__, self.name)
+
+
class Subject(Model):
"""See http://docs.fakturoid.apiary.io/ for complete field reference."""
name = None