Fixed rulings errors for consistency.

This commit is contained in:
Nanda Scott 2018-02-16 19:02:51 -05:00
parent 10000d401f
commit b00fb026d5
2 changed files with 11 additions and 8 deletions

View File

@ -13,3 +13,6 @@ from scrython.rulings import Mtgo
from scrython.rulings import Multiverse from scrython.rulings import Multiverse
from scrython.rulings import Id from scrython.rulings import Id
from scrython.rulings import Code from scrython.rulings import Code
#Import classes from sets
from scrython.sets import Code

View File

@ -40,48 +40,48 @@ class RulingsObject(object):
def object(self): def object(self):
if self.__checkForKey('object') is None: if self.__checkForKey('object') is None:
return KeyError('This object has no key \'object\'') raise KeyError('This object has no key \'object\'')
return self.scryfallJson['object'] return self.scryfallJson['object']
def has_more(self): def has_more(self):
if self.__checkForKey('has_more') is None: if self.__checkForKey('has_more') is None:
return KeyError('This object has no key \'has_more\'') raise KeyError('This object has no key \'has_more\'')
return self.scryfallJson['has_more'] return self.scryfallJson['has_more']
def data(self): def data(self):
if self.__checkForKey('data') is None: if self.__checkForKey('data') is None:
return KeyError('This object has no key \'data\'') raise KeyError('This object has no key \'data\'')
return self.scryfallJson['data'] return self.scryfallJson['data']
def data_length(self): def data_length(self):
if self.__checkForKey('data') is None: if self.__checkForKey('data') is None:
return KeyError('This object has no key \'data\'') raise KeyError('This object has no key \'data\'')
return len(self.scryfallJson['data']) return len(self.scryfallJson['data'])
def ruling_object(self, num): def ruling_object(self, num):
if self.__checkForTupleKey('data', num, 'object') is None: if self.__checkForTupleKey('data', num, 'object') is None:
return KeyError('This ruling has no key \'object\'') raise KeyError('This ruling has no key \'object\'')
return self.scryfallJson['data'][num]['object'] return self.scryfallJson['data'][num]['object']
def ruling_source(self, num): def ruling_source(self, num):
if self.__checkForTupleKey('data', num, 'source') is None: if self.__checkForTupleKey('data', num, 'source') is None:
return KeyError('This ruling has no key \'source\'') raise KeyError('This ruling has no key \'source\'')
return self.scryfallJson['data'][num]['source'] return self.scryfallJson['data'][num]['source']
def ruling_published_at(self, num): def ruling_published_at(self, num):
if self.__checkForTupleKey('data', num, 'published_at') is None: if self.__checkForTupleKey('data', num, 'published_at') is None:
return KeyError('This ruling has no key \'published_at\'') raise KeyError('This ruling has no key \'published_at\'')
return self.scryfallJson['data'][num]['published_at'] return self.scryfallJson['data'][num]['published_at']
def ruling_comment(self, num): def ruling_comment(self, num):
if self.__checkForTupleKey('data', num, 'comment') is None: if self.__checkForTupleKey('data', num, 'comment') is None:
return KeyError('This ruling has no key \'comment\'') raise KeyError('This ruling has no key \'comment\'')
return self.scryfallJson['data'][num]['comment'] return self.scryfallJson['data'][num]['comment']