Updated docs for catalogs

This commit is contained in:
Nanda Scott 2018-10-23 22:43:36 -04:00
parent d44c1cb87d
commit cdda608ad6
14 changed files with 30 additions and 130 deletions

View File

@ -6,15 +6,6 @@ class ArtifactTypes(CatalogsObject):
Catalog object for all known artifact types
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Example usage:
>>> catalog = scrython.catalog.ArtifactTypes()
>>> catalog.data()

View File

@ -6,15 +6,6 @@ class ArtistNames(CatalogsObject):
Catalog object for all known card names.
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Example usage:
>>> catalog = scrython.catalog.CardNames()
>>> catalog.data()

View File

@ -6,15 +6,6 @@ class CardNames(CatalogsObject):
Catalog object for all known card names.
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Example usage:
>>> catalog = scrython.catalog.CardNames()
>>> catalog.data()

View File

@ -7,18 +7,14 @@ class CatalogsObject(object):
"""
Master object for all catalog objects.
Positional Arguments:
No arguments are required.
Optional Arguments:
format : str ................... The format to return. Defaults to JSON.
pretty : bool ... Makes the returned JSON prettier. The library may not work properly with this setting.
Attributes:
object : str ...... Returns the type of object it is. (card, error, etc)
uri : str .................. The API URI for the endpoint you've called.
total_values : int ..................... The number of items in `data()`
data : list .............. A list of all types returned by the endpoint.
Args:
format (string, optional):
Defaults to 'json'.
Returns data in the specified method.
pretty (string, optional):
Defaults to empty string.
Returns a prettier version of the json object.
Note that this may break functionality with Scrython.
"""
def __init__(self, _url, **kwargs):
self.params = {'format': kwargs.get('format', 'json'), 'pretty': kwargs.get('pretty', '')}
@ -50,21 +46,42 @@ class CatalogsObject(object):
raise KeyError('This card has no key \'{}\''.format(key))
def object(self):
"""Returns the type of object it is
(card, error, etc)
Returns:
string
"""
self._checkForKey('object')
return self.scryfallJson['object']
def uri(self):
"""The API URI for the endpoint you've called.
Returns:
string
"""
self._checkForKey('uri')
return self.scryfallJson['uri']
def total_values(self):
"""The number of items in `data()`
Returns:
integer
"""
self._checkForKey('total_values')
return self.scryfallJson['total_values']
def data(self):
"""A list of all types returned by the endpoint
Returns:
list
"""
self._checkForKey('data')
return self.scryfallJson['data']

View File

@ -6,15 +6,6 @@ class CreatureTypes(CatalogsObject):
Catalog object for all known creature types.
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Example usage:
>>> catalog = scrython.catalog.CreatureTypes()
>>> catalog.data()

View File

@ -6,15 +6,6 @@ class EnchantmentTypes(CatalogsObject):
Catalog object for all known enchantment types.
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Example usage:
>>> catalog = scrython.catalog.EnchantmentTypes()
>>> catalog.data()

View File

@ -6,15 +6,6 @@ class LandTypes(CatalogsObject):
Catalog object for all known land types.
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Example usage:
>>> catalog = scrython.catalog.LandTypes()
>>> catalog.data()

View File

@ -6,15 +6,6 @@ class Loyalties(CatalogsObject):
Catalog object for all known starting loyalties.
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Example usage:
>>> catalog = scrython.catalog.Loyalties()
>>> catalog.data()

View File

@ -6,15 +6,6 @@ class PlaneswalkerTypes(CatalogsObject):
Catalog object for all known planeswalker types.
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Example usage:
>>> catalog = scrython.catalog.PlaneswalkerTypes()
>>> catalog.data()

View File

@ -6,15 +6,6 @@ class Powers(CatalogsObject):
Catalog object for all known powers.
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Example usage:
>>> catalog = scrython.catalog.Powers()
>>> catalog.data()

View File

@ -4,16 +4,7 @@ class SpellTypes(CatalogsObject):
"""
catalogs/spell-types
Catalog object for all known spell types
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Catalog object for all known spell types.
Example usage:
>>> catalog = scrython.catalog.SpellTypes()

View File

@ -6,15 +6,6 @@ class Toughnesses(CatalogsObject):
Catalog object for all known toughnesses.
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Example usage:
>>> catalog = scrython.catalog.Toughnesses()
>>> catalog.data()

View File

@ -6,15 +6,6 @@ class Watermarks(CatalogsObject):
Catalog object for all known watermarks.
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Example usage:
>>> catalog = scrython.catalog.Watermarks()
>>> catalog.data()

View File

@ -6,15 +6,6 @@ class WordBank(CatalogsObject):
Catalog object for all known words on all cards.
Positional Arguments:
No arguments are required.
Optional Arguments:
All arguments are inherited from CatalogsObject
Attributes:
All attributes are inherited from CatalogsObject
Example usage:
>>> catalog = scrython.catalog.WordBank()
>>> catalog.data()