Skip to content

Commit

Permalink
Fix: Get Vendor Call (#73)
Browse files Browse the repository at this point in the history
* Fix: Get Vendor Call

* Fix: Get Vendor Call
  • Loading branch information
ruuushhh authored Apr 16, 2024
1 parent 297c77d commit e44b350
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions sageintacctsdk/apis/vendors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,40 @@
from typing import Dict

from .api_base import ApiBase
from .constants import dimensions_fields_mapping


class Vendors(ApiBase):
"""Class for Vendors APIs."""
def __init__(self):
ApiBase.__init__(self, dimension='VENDOR')

def get(self, field: str, value: str, fields: list = None):
"""Get data from Sage Intacct based on filter.
Parameters:
field (str): A parameter to filter by the field. (required).
value (str): A parameter to filter by the field - value. (required).
Returns:
Dict.
"""
data = {
'query': {
'object': 'VENDOR',
'select':
{
'field': fields if fields else dimensions_fields_mapping['VENDOR'],
},
'pagesize': '1000',
'filter': {
'equalto': [
{
'field': field,
'value': value
}]
}
}
}

return self.format_and_send_request(data)['data']
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='sageintacctsdk',
version='1.19.1',
version='1.19.2',
author='Ashwin T',
author_email='ashwin.t@fyle.in',
description='Python SDK for accessing Sage Intacct APIs',
Expand Down

0 comments on commit e44b350

Please sign in to comment.