Skip to content

Commit

Permalink
Get Exchange Rate by Source (#19)
Browse files Browse the repository at this point in the history
* Get Exchange Rate by Source

* Remove trailing new lines
  • Loading branch information
Shwetabhk authored Apr 19, 2023
1 parent 2aa752e commit fe28a90
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions qbosdk/apis/exchange_rates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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))
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.15.0',
version='0.16.0',
author='Shwetabh Kumar',
author_email='[email protected]',
description='Python SDK for accessing Quickbooks Online APIs',
Expand Down

0 comments on commit fe28a90

Please sign in to comment.