Skip to content

Commit

Permalink
Add Data Dragon versions endpoint. (#200)
Browse files Browse the repository at this point in the history
 This gets a list of all of the valid versions for Data Dragon. https://ddragon.leagueoflegends.com/api/versions.json
  • Loading branch information
acgandhi authored Apr 5, 2022
1 parent da95089 commit bc971bf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/riotwatcher/_apis/league_of_legends/DataDragonApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def versions_for_region(self, region: str):
url, query = DataDragonUrls.versions(region=region)
return self._base_api.raw_request_static(url, query)

def versions_all(self):
url, query = DataDragonUrls.versions_all()
return self._base_api.raw_request_static(url, query)

def _request(self, endpoint: Endpoint, version: str, locale: str):
url, query = endpoint(version=version, locale=locale if locale else "en_US")
return self._base_api.raw_request_static(url, query)
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ class DataDragonUrls:
runes_reforged = DDragonVersionLocaleEndpoint("/runesReforged.json")
summoner_spells = DDragonVersionLocaleEndpoint("/summoner.json")
versions = DataDragonEndpoint("/realms/{region}.json")
versions_all = DataDragonEndpoint("/api/versions.json")
14 changes: 14 additions & 0 deletions tests/_apis/league_of_legends/test_DataDragonApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,17 @@ def test_version(self):
)

assert ret is expected_return

def test_version_all(self):
mock_base_api = MagicMock()
expected_return = object()
mock_base_api.raw_request_static.return_value = expected_return

static_data = DataDragonApi(mock_base_api)

ret = static_data.versions_all()

mock_base_api.raw_request_static.assert_called_once_with(
"https://ddragon.leagueoflegends.com/api/versions.json",
{},
)

0 comments on commit bc971bf

Please sign in to comment.