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 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: Example usage:
>>> catalog = scrython.catalog.ArtifactTypes() >>> catalog = scrython.catalog.ArtifactTypes()
>>> catalog.data() >>> catalog.data()

View File

@ -6,15 +6,6 @@ class ArtistNames(CatalogsObject):
Catalog object for all known card names. 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: Example usage:
>>> catalog = scrython.catalog.CardNames() >>> catalog = scrython.catalog.CardNames()
>>> catalog.data() >>> catalog.data()

View File

@ -6,15 +6,6 @@ class CardNames(CatalogsObject):
Catalog object for all known card names. 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: Example usage:
>>> catalog = scrython.catalog.CardNames() >>> catalog = scrython.catalog.CardNames()
>>> catalog.data() >>> catalog.data()

View File

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

View File

@ -6,15 +6,6 @@ class CreatureTypes(CatalogsObject):
Catalog object for all known creature types. 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: Example usage:
>>> catalog = scrython.catalog.CreatureTypes() >>> catalog = scrython.catalog.CreatureTypes()
>>> catalog.data() >>> catalog.data()

View File

@ -6,15 +6,6 @@ class EnchantmentTypes(CatalogsObject):
Catalog object for all known enchantment types. 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: Example usage:
>>> catalog = scrython.catalog.EnchantmentTypes() >>> catalog = scrython.catalog.EnchantmentTypes()
>>> catalog.data() >>> catalog.data()

View File

@ -6,15 +6,6 @@ class LandTypes(CatalogsObject):
Catalog object for all known land types. 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: Example usage:
>>> catalog = scrython.catalog.LandTypes() >>> catalog = scrython.catalog.LandTypes()
>>> catalog.data() >>> catalog.data()

View File

@ -6,15 +6,6 @@ class Loyalties(CatalogsObject):
Catalog object for all known starting loyalties. 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: Example usage:
>>> catalog = scrython.catalog.Loyalties() >>> catalog = scrython.catalog.Loyalties()
>>> catalog.data() >>> catalog.data()

View File

@ -6,15 +6,6 @@ class PlaneswalkerTypes(CatalogsObject):
Catalog object for all known planeswalker types. 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: Example usage:
>>> catalog = scrython.catalog.PlaneswalkerTypes() >>> catalog = scrython.catalog.PlaneswalkerTypes()
>>> catalog.data() >>> catalog.data()

View File

@ -6,15 +6,6 @@ class Powers(CatalogsObject):
Catalog object for all known powers. 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: Example usage:
>>> catalog = scrython.catalog.Powers() >>> catalog = scrython.catalog.Powers()
>>> catalog.data() >>> catalog.data()

View File

@ -4,16 +4,7 @@ class SpellTypes(CatalogsObject):
""" """
catalogs/spell-types catalogs/spell-types
Catalog object for all known 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
Example usage: Example usage:
>>> catalog = scrython.catalog.SpellTypes() >>> catalog = scrython.catalog.SpellTypes()

View File

@ -6,15 +6,6 @@ class Toughnesses(CatalogsObject):
Catalog object for all known toughnesses. 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: Example usage:
>>> catalog = scrython.catalog.Toughnesses() >>> catalog = scrython.catalog.Toughnesses()
>>> catalog.data() >>> catalog.data()

View File

@ -6,15 +6,6 @@ class Watermarks(CatalogsObject):
Catalog object for all known watermarks. 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: Example usage:
>>> catalog = scrython.catalog.Watermarks() >>> catalog = scrython.catalog.Watermarks()
>>> catalog.data() >>> catalog.data()

View File

@ -6,15 +6,6 @@ class WordBank(CatalogsObject):
Catalog object for all known words on all cards. 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: Example usage:
>>> catalog = scrython.catalog.WordBank() >>> catalog = scrython.catalog.WordBank()
>>> catalog.data() >>> catalog.data()