Scrython/scrython/sets/sets.py

134 lines
4.7 KiB
Python
Raw Normal View History

import sys
sys.path.append('..')
from scrython.foundation import FoundationObject
2018-02-17 00:27:25 +00:00
class Sets(FoundationObject):
2018-02-22 00:00:01 +00:00
"""
/sets
`Sets()` gets it's own special attributes that don't match with the normal set attributes.
Positional arguments:
code : str ............................... The 3 letter code of the set.
Optional arguments:
All arguments are inherited from SetsObject
Attributes:
object : str ... Returns the type of object it is. (card, error, etc)
has_more : bool ... True if there are more pages available.
data : list ... List of all data returned.
data_length : int ... The length of the data returned.
The following require an integer as an arg, which acts as a tuple.
set_object(num) : str .................................. The set object.
set_code(num) : str .............. The three letter set code of the set.
set_mtgo_code(num) : str .............. The mtgo equivalent of `code()`.
set_name(num) : str .......................... The full name of the set.
set_set_type(num) : str ... The type of the set (expansion, commander, etc)
set_released_at(num) : str .............. The date the set was launched.
set_block_code(num) : str ... The the letter code for the block the set was in.
set_block(num) : str .......... The full name of the block a set was in.
set_parent_set_code(num) : str ........ The set code for the parent set.
set_card_count(num) : int .............. The number of cards in the set.
set_digital(num) : bool ..... True if this set is only featured on MTGO.
2018-10-22 14:36:15 +00:00
set_foil_only(num) : bool ............. True if this set only has foils.
2018-02-22 00:00:01 +00:00
set_icon_svg_uri(num) : str ........ A URI to the SVG of the set symbol.
set_search_uri(num) : str ......... The scryfall API url for the search.
Example usage:
>>> set = scrython.sets.Sets()
>>> set.name(5)
"""
2018-02-17 00:31:08 +00:00
def __init__(self):
2018-02-17 00:27:25 +00:00
self._url = 'sets?'
super(Sets, self).__init__(self._url)
def object(self):
super(Sets, self)._checkForKey('object')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['object']
def has_more(self):
super(Sets, self)._checkForKey('has_more')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['has_more']
def data(self):
super(Sets, self)._checkForKey('data')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data']
def data_length(self):
super(Sets, self)._checkForKey('data')
2018-02-17 00:27:25 +00:00
return len(self.scryfallJson['data'])
def set_object(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'object')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['object']
def set_code(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'code')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['code']
def set_mtgo_code(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'mtgo_code')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['mtgo_code']
def set_name(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'name')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['name']
def set_set_type(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'set_type')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['set_type']
def set_released_at(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'released_at')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['released_at']
def set_block_code(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'block_code')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['block_code']
def set_block(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'block')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['block']
def set_parent_set_code(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'parent_set_code')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['parent_set_code']
def set_card_count(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'card_count')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['card_count']
def set_digital(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'digital')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['digital']
2018-10-22 14:36:15 +00:00
def set_foil_only(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'foil_only')
2018-02-17 00:27:25 +00:00
2018-10-22 14:36:15 +00:00
return self.scryfallJson['data'][num]['foil_only']
2018-02-17 00:27:25 +00:00
def set_icon_svg_uri(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'icon_svg_uri')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['icon_svg_uri']
def set_search_uri(self, num):
super(Sets, self)._checkForTupleKey('data', num, 'search_uri')
2018-02-17 00:27:25 +00:00
return self.scryfallJson['data'][num]['search_uri']