Skip to content

Commit 990ac4f

Browse files
Ashutosh619-sudoAshutosh619-sudo
andauthored
Feat: Support for getting exchange rate of any date (#37)
* Feat: Support for getting exchange rate of any date * bump up version * small change --------- Co-authored-by: Ashutosh619-sudo <ashutosh.s@fyle.com>
1 parent 52bd866 commit 990ac4f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

qbosdk/apis/exchange_rates.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ def get_all_generator(self, as_of_date: str = None):
3636
ExchangeRates.GET_EXCHANGE_RATES = ExchangeRates.GET_EXCHANGE_RATES.format(as_of_date, '{0}')
3737
return self._query_get_all_generator('ExchangeRate', ExchangeRates.GET_EXCHANGE_RATES)
3838

39-
def get_by_source(self, source_currency_code: str):
39+
def get_by_source(self, source_currency_code: str, as_of_date: str = None):
4040
"""
4141
Get all the exchange rates
4242
:param as_of_date: date to get rates for (1 day prior if left empty)
4343
:return: List of Dicts for exchange rates
4444
"""
45-
as_of_date = (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")
45+
if not as_of_date:
46+
as_of_date = (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")
4647
return self._get_request(
4748
'ExchangeRate', self.GET_EXCHANGE_RATES_BY_SOURCE.format(source_currency_code, as_of_date))

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setuptools.setup(
1010
name='qbosdk',
11-
version='0.21.0',
11+
version='0.22.0',
1212
author='Shwetabh Kumar',
1313
author_email='shwetabh.kumar@fyle.in',
1414
description='Python SDK for accessing Quickbooks Online APIs',

0 commit comments

Comments
 (0)