-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Oli Girling
committed
Sep 28, 2023
1 parent
6b06597
commit ae04984
Showing
20 changed files
with
188 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.DS_Store | ||
.env | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ FROM python:3-alpine | |
WORKDIR /app | ||
|
||
RUN pip install requests \ | ||
coverage | ||
coverage \ | ||
twine \ | ||
wheel | ||
|
||
COPY . . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from currencyapi.client import Client | ||
from currencyapi.currency import Currency |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from currencyapi.endpoints.rates import Rates | ||
from currencyapi.endpoints.convert import Convert | ||
from currencyapi.endpoints.history import History | ||
from currencyapi.endpoints.timeframe import Timeframe | ||
from currencyapi.endpoints.currencies import Currencies | ||
|
||
class Currency(object): | ||
def __init__(self, api_key: str): | ||
self._api_key = api_key | ||
|
||
def rates(self) -> Rates: | ||
return Rates(self._api_key) | ||
|
||
def convert(self) -> Convert: | ||
return Convert(self._api_key) | ||
|
||
def history(self) -> History: | ||
return History(self._api_key) | ||
|
||
def timeframe(self) -> Timeframe: | ||
return Timeframe(self._api_key) | ||
|
||
def currencies(self) -> Currencies: | ||
return Currencies(self._api_key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from currencyapi.currency import Currency | ||
|
||
currency = Currency('') | ||
print(currency.history().output('JSON').date('2013-01-02').get()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from currencyapi import Currency | ||
from currencyapi.endpoints.rates import Rates | ||
from currencyapi.endpoints.history import History | ||
from currencyapi.endpoints.timeframe import Timeframe | ||
from currencyapi.endpoints.convert import Convert | ||
from currencyapi.endpoints.currencies import Currencies | ||
from unittest import TestCase | ||
|
||
class Test(TestCase): | ||
def test_rates_method(self): | ||
class_under_test = Currency('fakeKey') | ||
self.assertIsInstance(class_under_test.rates(), Rates) | ||
|
||
def test_history_method(self): | ||
class_under_test = Currency('fakeKey') | ||
self.assertIsInstance(class_under_test.history(), History) | ||
|
||
def test_timeframe_method(self): | ||
class_under_test = Currency('fakeKey') | ||
self.assertIsInstance(class_under_test.timeframe(), Timeframe) | ||
|
||
def test_convert_method(self): | ||
class_under_test = Currency('fakeKey') | ||
self.assertIsInstance(class_under_test.convert(), Convert) | ||
|
||
def test_currencies_method(self): | ||
class_under_test = Currency('fakeKey') | ||
self.assertIsInstance(class_under_test.currencies(), Currencies) |