Skip to content

Commit

Permalink
Feature: Search Vendor by Display Name (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shwetabhk authored Mar 30, 2021
1 parent 489db69 commit e65952e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions qbosdk/apis/vendors.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Vendors(ApiBase):

GET_VENDORS = '/query?query=select * from Vendor STARTPOSITION {0} MAXRESULTS 1000'
POST_VENDOR = '/vendor?minorversion=38'
SEARCH_VENDOR = "/query?query=select * from Vendor where DisplayName = '{0}'"

def get(self):
"""Get a list of the existing Vendors in the Organization.
Expand All @@ -27,3 +28,13 @@ def post(self, data: Dict):
:return:
"""
return self._post_request(data, Vendors.POST_VENDOR)

def search_vendor_by_display_name(self, display_name=None):
"""
Search vendor by display name
:param display_name: Quickbooks Vendor Display Name
:return: Vendor
"""
response = self._get_request('QueryResponse', Vendors.SEARCH_VENDOR.format(display_name))

return response['Vendor'][0] if 'Vendor' in response else None
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.8.0',
version='0.9.0',
author='Shwetabh Kumar',
author_email='[email protected]',
description='Python SDK for accessing Quickbooks Online APIs',
Expand Down

0 comments on commit e65952e

Please sign in to comment.