Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_by_id support for Journal Entry #32

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ venv.bak/
.mypy_cache/
.dmypy.json
dmypy.json
private/

# Pyre type checker
.pyre/
2 changes: 1 addition & 1 deletion qbosdk/apis/api_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions qbosdk/apis/journal_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down