Merge pull request #43 from dstathis/master
Update for some scryfall api changes
This commit is contained in:
		
						commit
						447d5f557b
					
				| 
						 | 
				
			
			@ -420,15 +420,15 @@ class CardsObject(FoundationObject):
 | 
			
		|||
 | 
			
		||||
        return self.scryfallJson['frame']
 | 
			
		||||
 | 
			
		||||
    def frame_effect(self):
 | 
			
		||||
    def frame_effects(self):
 | 
			
		||||
        """The card's frame effect, if any. (miracle, nyxtouched, etc.)
 | 
			
		||||
        
 | 
			
		||||
        Returns:
 | 
			
		||||
            string: The card's frame effect.
 | 
			
		||||
            list: The card's frame effects.
 | 
			
		||||
        """
 | 
			
		||||
        super(CardsObject, self)._checkForKey('frame_effect')
 | 
			
		||||
        super(CardsObject, self)._checkForKey('frame_effects')
 | 
			
		||||
 | 
			
		||||
        return self.scryfallJson['frame_effect']
 | 
			
		||||
        return self.scryfallJson['frame_effects']
 | 
			
		||||
 | 
			
		||||
    def full_art(self):
 | 
			
		||||
        """Returns True if the card is considered full art
 | 
			
		||||
| 
						 | 
				
			
			@ -472,13 +472,13 @@ class CardsObject(FoundationObject):
 | 
			
		|||
        Returns:
 | 
			
		||||
            float: The prices as a float
 | 
			
		||||
        """
 | 
			
		||||
        modes = ['usd', 'eur', 'tix']
 | 
			
		||||
        modes = ['usd', 'usd_foil', 'eur', 'tix']
 | 
			
		||||
        if mode not in modes:
 | 
			
		||||
            raise KeyError("{} is not a key.".format(mode))
 | 
			
		||||
 | 
			
		||||
        super(CardsObject, self)._checkForKey(mode)
 | 
			
		||||
        super(CardsObject, self)._checkForKey('prices', mode)
 | 
			
		||||
 | 
			
		||||
        return self.scryfallJson[mode]
 | 
			
		||||
        return self.scryfallJson['prices'][mode]
 | 
			
		||||
 | 
			
		||||
    def related_uris(self):
 | 
			
		||||
        """A dictionary of related websites for this card
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ class FoundationObject(object):
 | 
			
		|||
        if self.scryfallJson['object'] == 'error':
 | 
			
		||||
            raise ScryfallError(self.scryfallJson, self.scryfallJson['details'])
 | 
			
		||||
 | 
			
		||||
    def _checkForKey(self, key):
 | 
			
		||||
    def _checkForKey(self, key, nested_key=None):
 | 
			
		||||
        """Checks for a key in the scryfallJson object.
 | 
			
		||||
        This function should be considered private, and
 | 
			
		||||
        should not be accessed in production.
 | 
			
		||||
| 
						 | 
				
			
			@ -51,6 +51,11 @@ class FoundationObject(object):
 | 
			
		|||
        if not key in self.scryfallJson:
 | 
			
		||||
            raise KeyError('This card has no key \'{}\''.format(key))
 | 
			
		||||
 | 
			
		||||
        if nested_key:
 | 
			
		||||
            if not nested_key in self.scryfallJson[key]:
 | 
			
		||||
                raise KeyError('This card has no key \'{}.{}\''.format(key, nested_key))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def _checkForTupleKey(self, parent, num, key):
 | 
			
		||||
        """Checks for a key of an object in an array.
 | 
			
		||||
        This function should be considered private, and
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -240,8 +240,8 @@ class TestSearch(unittest.TestCase):
 | 
			
		|||
    def test_tcgplayer_id(self):
 | 
			
		||||
        self.assertIsInstance(non_online_card.tcgplayer_id(), int)
 | 
			
		||||
 | 
			
		||||
    def test_frame_effect(self):
 | 
			
		||||
        self.assertIsInstance(transform.frame_effect(), str)
 | 
			
		||||
    def test_frame_effects(self):
 | 
			
		||||
        self.assertIsInstance(transform.frame_effects(), list)
 | 
			
		||||
 | 
			
		||||
    def test_games(self):
 | 
			
		||||
        self.assertIsInstance(non_online_card.games(), list)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue