diff --git a/.gitignore b/.gitignore index 9ed92e0..761fe40 100644 --- a/.gitignore +++ b/.gitignore @@ -132,6 +132,7 @@ venv.bak/ .mypy_cache/ .dmypy.json dmypy.json +private/ # Pyre type checker .pyre/ diff --git a/qbosdk/apis/api_base.py b/qbosdk/apis/api_base.py index 790e1e9..3c684a0 100644 --- a/qbosdk/apis/api_base.py +++ b/qbosdk/apis/api_base.py @@ -162,7 +162,7 @@ def _query(self, url: str) -> List[Dict]: if response.status_code == 200: logger.debug('Response for get request for url: %s, %s', url, response.text) data = json.loads(response.text) - return data['QueryResponse'] + return data['QueryResponse'] if 'QueryResponse' in data else data logger.info('Response for get request for url: %s, %s', url, response.text) if response.status_code == 400: diff --git a/qbosdk/apis/journal_entries.py b/qbosdk/apis/journal_entries.py index 9b734c4..2312c9f 100644 --- a/qbosdk/apis/journal_entries.py +++ b/qbosdk/apis/journal_entries.py @@ -11,6 +11,7 @@ class JournalEntries(ApiBase): GET_JOURNAL_ENTRIES = '/query?query=select * from JournalEntry STARTPOSITION {0} MAXRESULTS 1000' POST_JOURNAL_ENTRY = '/journalentry?minorversion=53' DELETE_JOURNAL_ENTRY = '/journalentry?operation=delete' + GET_JOURNAL_ENTRY_BY_ID = '/journalentry/{0}' def get(self): """ @@ -34,6 +35,14 @@ def post(self, data: Dict): """ return self._post_request(data, JournalEntries.POST_JOURNAL_ENTRY) + def get_by_id(self, journal_entry_id): + """ + Get JournalEntry by Id + :param journal_entry_id: Journal Entry Id + :return: Dict in JournalEntry schema + """ + return self._get_request('JournalEntry', JournalEntries.GET_JOURNAL_ENTRY_BY_ID.format(journal_entry_id)) + def delete(self, journal_entry_id: str): """ Delete JournalEntry from Quickbooks Online diff --git a/setup.py b/setup.py index c8afca0..fee1dfc 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name='qbosdk', - version='0.19.0', + version='0.20.0', author='Shwetabh Kumar', author_email='shwetabh.kumar@fyle.in', description='Python SDK for accessing Quickbooks Online APIs',