-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from PokeAPI/beckett
Uses Beckett API Client Framework
- Loading branch information
Showing
14 changed files
with
417 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,8 @@ | |
*.so | ||
|
||
# Packages | ||
*.egg | ||
*.egg* | ||
*.cache | ||
*.egg-info | ||
dist | ||
build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ lint: | |
flake8 pykemon tests | ||
|
||
test: | ||
python setup.py test | ||
py.test tests/ | ||
|
||
test-all: | ||
tox | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from beckett.resources import BaseResource | ||
|
||
|
||
class PokemonResource(BaseResource): | ||
class Meta(BaseResource.Meta): | ||
name = 'Pokemon' | ||
resource_name = 'pokemon' | ||
identifier = 'id' | ||
methods = ( | ||
'get', | ||
) | ||
attributes = ( | ||
'created', | ||
'modified', | ||
'national_id', | ||
'abilities', | ||
'egg_groups', | ||
'evolutions', | ||
'descriptions', | ||
'moves', | ||
'types', | ||
'catch_rate', | ||
'species', | ||
'hp', | ||
'attack', | ||
'defense', | ||
'name', | ||
'sp_atk', | ||
'sp_def', | ||
'speed', | ||
'total', | ||
'egg_cycles', | ||
'ev_yield', | ||
'exp', | ||
'growth_rate', | ||
'height', | ||
'weight', | ||
'happiness', | ||
'male_female_ratio', | ||
'sprites', | ||
) | ||
|
||
@staticmethod | ||
def get_single_resource_url(url, uid, **kwargs): | ||
# Needs a slash on the end! | ||
return '{}/{}/'.format(url, uid) | ||
|
||
|
||
class MoveResource(BaseResource): | ||
|
||
class Meta(BaseResource.Meta): | ||
name = 'Move' | ||
resource_name = 'move' | ||
identifier = 'id' | ||
methods = ( | ||
'get', | ||
) | ||
attributes = ( | ||
'created', | ||
'modified', | ||
'id', | ||
'accuracy', | ||
'category', | ||
'power', | ||
'pp', | ||
'name', | ||
) | ||
|
||
@staticmethod | ||
def get_single_resource_url(url, uid, **kwargs): | ||
# Needs a slash on the end! | ||
return '{}/{}/'.format(url, uid) | ||
|
||
|
||
class TypeResource(BaseResource): | ||
|
||
class Meta(BaseResource.Meta): | ||
name = 'Type' | ||
resource_name = 'type' | ||
identifier = 'id' | ||
methods = ( | ||
'get', | ||
) | ||
attributes = ( | ||
'created', | ||
'modified', | ||
'id', | ||
'name', | ||
'ineffective', | ||
'resistance', | ||
'super_effective', | ||
'weakness', | ||
) | ||
|
||
@staticmethod | ||
def get_single_resource_url(url, uid, **kwargs): | ||
# Needs a slash on the end! | ||
return '{}/{}/'.format(url, uid) | ||
|
||
|
||
class AbilityResource(BaseResource): | ||
|
||
class Meta(BaseResource.Meta): | ||
name = 'Ability' | ||
resource_name = 'ability' | ||
identifier = 'id' | ||
methods = ( | ||
'get', | ||
) | ||
attributes = ( | ||
'created', | ||
'modified', | ||
'id', | ||
'name', | ||
'description', | ||
) | ||
|
||
@staticmethod | ||
def get_single_resource_url(url, uid, **kwargs): | ||
# Needs a slash on the end! | ||
return '{}/{}/'.format(url, uid) | ||
|
||
|
||
class EggResource(BaseResource): | ||
|
||
class Meta(BaseResource.Meta): | ||
name = 'Egg' | ||
resource_name = 'egg' | ||
identifier = 'id' | ||
methods = ( | ||
'get', | ||
) | ||
attributes = ( | ||
'created', | ||
'modified', | ||
'id', | ||
'name', | ||
'pokemon', | ||
) | ||
|
||
@staticmethod | ||
def get_single_resource_url(url, uid, **kwargs): | ||
# Needs a slash on the end! | ||
return '{}/{}/'.format(url, uid) | ||
|
||
|
||
class DescriptionResource(BaseResource): | ||
|
||
class Meta(BaseResource.Meta): | ||
name = 'Description' | ||
resource_name = 'description' | ||
identifier = 'id' | ||
methods = ( | ||
'get', | ||
) | ||
attributes = ( | ||
'created', | ||
'modified', | ||
'id', | ||
'name', | ||
'description', | ||
'pokemon', | ||
'games', | ||
) | ||
|
||
@staticmethod | ||
def get_single_resource_url(url, uid, **kwargs): | ||
# Needs a slash on the end! | ||
return '{}/{}/'.format(url, uid) | ||
|
||
|
||
class SpriteResource(BaseResource): | ||
|
||
class Meta(BaseResource.Meta): | ||
name = 'Sprite' | ||
resource_name = 'sprite' | ||
identifier = 'id' | ||
methods = ( | ||
'get', | ||
) | ||
attributes = ( | ||
'created', | ||
'modified', | ||
'id', | ||
'name', | ||
'pokemon', | ||
'image', | ||
) | ||
|
||
@staticmethod | ||
def get_single_resource_url(url, uid, **kwargs): | ||
# Needs a slash on the end! | ||
return '{}/{}/'.format(url, uid) | ||
|
||
|
||
class GameResource(BaseResource): | ||
|
||
class Meta(BaseResource.Meta): | ||
name = 'Game' | ||
resource_name = 'game' | ||
identifier = 'id' | ||
methods = ( | ||
'get', | ||
) | ||
attributes = ( | ||
'created', | ||
'modified', | ||
'id', | ||
'name', | ||
'generation', | ||
'release_year', | ||
) | ||
|
||
@staticmethod | ||
def get_single_resource_url(url, uid, **kwargs): | ||
# Needs a slash on the end! | ||
return '{}/{}/'.format(url, uid) |
Oops, something went wrong.