From fe28a9071d8ef2398337ca2efb0dc2b1f93ea33b Mon Sep 17 00:00:00 2001 From: Shwetabh Kumar Date: Wed, 19 Apr 2023 21:12:39 +0530 Subject: [PATCH] Get Exchange Rate by Source (#19) * Get Exchange Rate by Source * Remove trailing new lines --- qbosdk/apis/exchange_rates.py | 10 ++++++++++ setup.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/qbosdk/apis/exchange_rates.py b/qbosdk/apis/exchange_rates.py index 872d84d..c6ae30e 100644 --- a/qbosdk/apis/exchange_rates.py +++ b/qbosdk/apis/exchange_rates.py @@ -10,6 +10,7 @@ class ExchangeRates(ApiBase): GET_EXCHANGE_RATES = "/query?query=select * from ExchangeRate where AsOfDate = '{0}' STARTPOSITION " \ "{1} MAXRESULTS 1000" + GET_EXCHANGE_RATES_BY_SOURCE = "/exchangerate?sourcecurrencycode={0}" def get(self, as_of_date: str = None): """ @@ -22,3 +23,12 @@ def get(self, as_of_date: str = None): ExchangeRates.GET_EXCHANGE_RATES = ExchangeRates.GET_EXCHANGE_RATES.format(as_of_date, '{0}') return self._query_get_all('ExchangeRate', ExchangeRates.GET_EXCHANGE_RATES) + + def get_by_source(self, source_currency_code: str): + """ + Get all the exchange rates + :param as_of_date: date to get rates for (1 day prior if left empty) + :return: List of Dicts for exchange rates + """ + return self._get_request( + 'ExchangeRate', self.GET_EXCHANGE_RATES_BY_SOURCE.format(source_currency_code)) diff --git a/setup.py b/setup.py index c4f1b9f..24f891d 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setuptools.setup( name='qbosdk', - version='0.15.0', + version='0.16.0', author='Shwetabh Kumar', author_email='shwetabh.kumar@fyle.in', description='Python SDK for accessing Quickbooks Online APIs',