From 36f40268d21b5bd6cbf7b20193aa60c3377ecdc9 Mon Sep 17 00:00:00 2001 From: Pedro Lamkowski Date: Mon, 25 Jul 2022 18:51:59 -0300 Subject: [PATCH] Added new classes to fetch keywords and ability words from the API --- docs/scrython.catalog/AbilityWords.md | 66 +++++++++++++++++++++++ docs/scrython.catalog/KeywordAbilities.md | 66 +++++++++++++++++++++++ docs/scrython.catalog/KeywordActions.md | 66 +++++++++++++++++++++++ scrython/__init__.py | 7 +++ scrython/catalog/__init__.py | 10 +++- scrython/catalog/ability_words.py | 26 +++++++++ scrython/catalog/keyword_abilities.py | 26 +++++++++ scrython/catalog/keyword_actions.py | 26 +++++++++ 8 files changed, 291 insertions(+), 2 deletions(-) create mode 100644 docs/scrython.catalog/AbilityWords.md create mode 100644 docs/scrython.catalog/KeywordAbilities.md create mode 100644 docs/scrython.catalog/KeywordActions.md create mode 100644 scrython/catalog/ability_words.py create mode 100644 scrython/catalog/keyword_abilities.py create mode 100644 scrython/catalog/keyword_actions.py diff --git a/docs/scrython.catalog/AbilityWords.md b/docs/scrython.catalog/AbilityWords.md new file mode 100644 index 0000000..d8e983b --- /dev/null +++ b/docs/scrython.catalog/AbilityWords.md @@ -0,0 +1,66 @@ +# **class** `scrython.catalog.AbilityWords()` + +These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. + +>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`AbilityWords().scryfallJson`). + +## Args + +|arg|type|description| +|:---:|:---:|:---:| + +## Returns +N/A + +## Raises +N/A + +## Examples +```python +>>> catalog = scrython.catalog.KeywordAbilities() +>>> catalog.data() +``` + +## Methods + +--- +### `data()` + +``` +A list of all types returned by the endpoint + + Returns: + list + +``` +--- +### `object()` + +``` +Returns the type of object it is + (card, error, etc) + + Returns: + string + +``` +--- +### `total_values()` + +``` +The number of items in `data()` + + Returns: + integer + +``` +--- +### `uri()` + +``` +The API URI for the endpoint you've called. + + Returns: + string + +``` \ No newline at end of file diff --git a/docs/scrython.catalog/KeywordAbilities.md b/docs/scrython.catalog/KeywordAbilities.md new file mode 100644 index 0000000..57ff1e6 --- /dev/null +++ b/docs/scrython.catalog/KeywordAbilities.md @@ -0,0 +1,66 @@ +# **class** `scrython.catalog.KeywordAbilities()` + +These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. + +>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`KeywordAbilities().scryfallJson`). + +## Args + +|arg|type|description| +|:---:|:---:|:---:| + +## Returns +N/A + +## Raises +N/A + +## Examples +```python +>>> catalog = scrython.catalog.KeywordAbilities() +>>> catalog.data() +``` + +## Methods + +--- +### `data()` + +``` +A list of all types returned by the endpoint + + Returns: + list + +``` +--- +### `object()` + +``` +Returns the type of object it is + (card, error, etc) + + Returns: + string + +``` +--- +### `total_values()` + +``` +The number of items in `data()` + + Returns: + integer + +``` +--- +### `uri()` + +``` +The API URI for the endpoint you've called. + + Returns: + string + +``` \ No newline at end of file diff --git a/docs/scrython.catalog/KeywordActions.md b/docs/scrython.catalog/KeywordActions.md new file mode 100644 index 0000000..52580d6 --- /dev/null +++ b/docs/scrython.catalog/KeywordActions.md @@ -0,0 +1,66 @@ +# **class** `scrython.catalog.KeywordActions()` + +These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information. + +>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`KeywordActions().scryfallJson`). + +## Args + +|arg|type|description| +|:---:|:---:|:---:| + +## Returns +N/A + +## Raises +N/A + +## Examples +```python +>>> catalog = scrython.catalog.KeywordActions() +>>> catalog.data() +``` + +## Methods + +--- +### `data()` + +``` +A list of all types returned by the endpoint + + Returns: + list + +``` +--- +### `object()` + +``` +Returns the type of object it is + (card, error, etc) + + Returns: + string + +``` +--- +### `total_values()` + +``` +The number of items in `data()` + + Returns: + integer + +``` +--- +### `uri()` + +``` +The API URI for the endpoint you've called. + + Returns: + string + +``` \ No newline at end of file diff --git a/scrython/__init__.py b/scrython/__init__.py index 4796016..92c553d 100644 --- a/scrython/__init__.py +++ b/scrython/__init__.py @@ -33,6 +33,10 @@ from scrython.catalog import Toughnesses from scrython.catalog import Watermarks from scrython.catalog import WordBank from scrython.catalog import ArtistNames +from scrython.catalog import KeywordAbilities +from scrython.catalog import KeywordActions +from scrython.catalog import AbilityWords + #Import symbology from scrython.symbology import ParseMana @@ -77,4 +81,7 @@ __all__ = [ 'Symbology', 'BulkData', 'ScryfallError', + 'KeywordAbilities', + 'KeywordActions', + 'AbilityWords' ] diff --git a/scrython/catalog/__init__.py b/scrython/catalog/__init__.py index 0bf18af..b5c36d9 100644 --- a/scrython/catalog/__init__.py +++ b/scrython/catalog/__init__.py @@ -11,6 +11,9 @@ from .toughnesses import Toughnesses from .watermarks import Watermarks from .word_bank import WordBank from .artist_names import ArtistNames +from .keyword_abilities import KeywordAbilities +from .keyword_actions import KeywordActions +from .ability_words import AbilityWords __all__ = [ 'ArtifactTypes', @@ -25,5 +28,8 @@ __all__ = [ 'Toughnesses', 'Watermarks', 'WordBank', - 'ArtistNames' -] \ No newline at end of file + 'ArtistNames', + 'KeywordAbilities', + 'KeywordActions', + 'AbilityWords' +] diff --git a/scrython/catalog/ability_words.py b/scrython/catalog/ability_words.py new file mode 100644 index 0000000..bd45dbd --- /dev/null +++ b/scrython/catalog/ability_words.py @@ -0,0 +1,26 @@ +from .catalogs_object import CatalogsObject + + +class AbilityWords(CatalogsObject): + """ + catalogs/ability-words + + Catalog object for all known ability words + + Args: + N/A + + Returns: + N/A + + Raises: + N/A + + Examples: + >>> catalog = scrython.catalog.KeywordAbilities() + >>> catalog.data() + """ + + def __init__(self): + self._url = 'catalog/ability-words?' + super(AbilityWords, self).__init__(self._url) diff --git a/scrython/catalog/keyword_abilities.py b/scrython/catalog/keyword_abilities.py new file mode 100644 index 0000000..5eaabe0 --- /dev/null +++ b/scrython/catalog/keyword_abilities.py @@ -0,0 +1,26 @@ +from .catalogs_object import CatalogsObject + + +class KeywordAbilities(CatalogsObject): + """ + catalog/keyword-abilities + + Catalog object for all known keyword abilities + + Args: + N/A + + Returns: + N/A + + Raises: + N/A + + Examples: + >>> catalog = scrython.catalog.KeywordAbilities() + >>> catalog.data() + """ + + def __init__(self): + self._url = 'catalog/keyword-abilities?' + super(KeywordAbilities, self).__init__(self._url) diff --git a/scrython/catalog/keyword_actions.py b/scrython/catalog/keyword_actions.py new file mode 100644 index 0000000..205ace3 --- /dev/null +++ b/scrython/catalog/keyword_actions.py @@ -0,0 +1,26 @@ +from .catalogs_object import CatalogsObject + + +class KeywordActions(CatalogsObject): + """ + catalog/keyword-actions + + Catalog object for all known keyword actions + + Args: + N/A + + Returns: + N/A + + Raises: + N/A + + Examples: + >>> catalog = scrython.catalog.KeywordActions() + >>> catalog.data() + """ + + def __init__(self): + self._url = 'catalog/keyword-actions?' + super(KeywordActions, self).__init__(self._url)