From a525ad597183ca1d1cb026db1ea392ffd51d17ec Mon Sep 17 00:00:00 2001 From: Nanda Scott Date: Mon, 22 Oct 2018 13:40:16 -0400 Subject: [PATCH] Added arena id endpoint --- scrython/__init__.py | 1 + scrython/cards/__init__.py | 1 + scrython/cards/arena_id.py | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 scrython/cards/arena_id.py diff --git a/scrython/__init__.py b/scrython/__init__.py index 75efb0c..6652a97 100644 --- a/scrython/__init__.py +++ b/scrython/__init__.py @@ -7,6 +7,7 @@ from scrython.cards import Multiverse from scrython.cards import Named from scrython.cards import Random from scrython.cards import Search +from scrython.cards import ArenaId #Import classes from rulings from scrython.rulings import Mtgo diff --git a/scrython/cards/__init__.py b/scrython/cards/__init__.py index 9939786..8842cd6 100644 --- a/scrython/cards/__init__.py +++ b/scrython/cards/__init__.py @@ -6,3 +6,4 @@ from .multiverse import Multiverse from .named import Named from .randomcard import Random from .search import Search +from .arena_id import ArenaId diff --git a/scrython/cards/arena_id.py b/scrython/cards/arena_id.py new file mode 100644 index 0000000..c7aa0b4 --- /dev/null +++ b/scrython/cards/arena_id.py @@ -0,0 +1,26 @@ +from .cards_object import CardsObject + +class ArenaId(CardsObject): + """ + cards/id + Get a card by the Arena id. + + Positional arguments: + id : str ....................... The Scryfall Id of the card. + + Optional arguments: + Inherits all arguments from CardsObject. + + Attributes: + All attributes are inherited from CardsObject. + + Example usage: + >>> card = scrython.cards.ArenaId(id="66975") + >>> card.name() + """ + def __init__(self, **kwargs): + if kwargs.get('id') is None: + raise TypeError('No id provided to search by') + + self.url = 'cards/arena/{}?'.format(str(kwargs.get('id'))) + super(ArenaId, self).__init__(self.url)