-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
eac50ca
commit 31a9dfb
Showing
9 changed files
with
99 additions
and
3 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 |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
) | ||
|
||
|
||
__version__ = "0.0.7" | ||
__version__ = "0.0.8" | ||
|
||
|
||
class BirdEye: | ||
|
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,40 @@ | ||
from typing import cast | ||
|
||
from birdeyepy.utils import BirdEyeApiUrls, BirdEyeRequestParams, IHttp, as_api_args | ||
|
||
|
||
class Pair: | ||
def __init__(self, http: IHttp) -> None: | ||
self.http = http | ||
|
||
@as_api_args | ||
def overview_multiple( | ||
self, | ||
*, | ||
list_address: list[str], | ||
) -> dict: | ||
"""Get overview of multiple pairs. | ||
:param list_address: A list of addresses | ||
""" | ||
params = {"list_address": list_address} | ||
request: BirdEyeRequestParams = {"params": params} | ||
response = self.http.send(path=BirdEyeApiUrls.PAIR_OVERVIEW_MULTIPLE, **request) | ||
|
||
return cast(dict, response) | ||
|
||
@as_api_args | ||
def overview_single( | ||
self, | ||
*, | ||
address: str, | ||
) -> dict: | ||
"""Get overview of single pair | ||
:param list_address: A list of addresses | ||
""" | ||
params = {"address": address} | ||
request: BirdEyeRequestParams = {"params": params} | ||
response = self.http.send(path=BirdEyeApiUrls.PAIR_OVERVIEW_SINGLE, **request) | ||
|
||
return cast(dict, response) |
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,5 @@ | ||
Pair | ||
==== | ||
|
||
.. autoclass:: birdeyepy.resources.pair.Pair | ||
:members: |
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,34 @@ | ||
from unittest.mock import MagicMock | ||
|
||
from birdeyepy.resources.pair import Pair | ||
from birdeyepy.utils import BirdEyeApiUrls | ||
|
||
|
||
def test_pair_overview_multiple_called_with_expected_args() -> None: | ||
# Arrange | ||
mock_http = MagicMock() | ||
|
||
# Act | ||
client = Pair(http=mock_http) | ||
client.overview_multiple(list_address=["test1", "test2"]) | ||
|
||
# Assert | ||
mock_http.send.assert_called_once_with( | ||
path=BirdEyeApiUrls.PAIR_OVERVIEW_MULTIPLE, | ||
params={"list_address": "test1,test2"}, | ||
) | ||
|
||
|
||
def test_pair_overview_single_called_with_expected_args() -> None: | ||
# Arrange | ||
mock_http = MagicMock() | ||
|
||
# Act | ||
client = Pair(http=mock_http) | ||
client.overview_single(address="test1") | ||
|
||
# Assert | ||
mock_http.send.assert_called_once_with( | ||
path=BirdEyeApiUrls.PAIR_OVERVIEW_SINGLE, | ||
params={"address": "test1"}, | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.