diff --git a/fyle/platform/internals/get_resources.py b/fyle/platform/internals/get_resources.py index e001451..1149470 100644 --- a/fyle/platform/internals/get_resources.py +++ b/fyle/platform/internals/get_resources.py @@ -17,19 +17,19 @@ def __init__(self, version, role, endpoint): self.api = ApiBase(self.version, self.role) - def get(self, id_: str = None, query_params=None) -> Dict: + def get_by_id(self, id_: str) -> Dict: """ Get Single Resource object by ID :param id_: Resource object ID - :param query_params: :return: Resource Object """ - query_params = {} if query_params is None else query_params + query_params = {} api_url = self.endpoint - if id_: - query_params['id'] = 'eq.{}'.format(id_) + if not id_: + raise exceptions.WrongParamsError('Invalid Parameters') + query_params['id'] = 'eq.{}'.format(id_) response = self.api.make_get_request( api_url=api_url, query_params=query_params, @@ -40,4 +40,6 @@ def get(self, id_: str = None, query_params=None) -> Dict: elif id_ and response['count'] > 1: raise exceptions.MultipleObjectReturned('Multiple Objects returned') - return response + return { + 'data': response.get('data')[0] + } \ No newline at end of file