aboutsummaryrefslogtreecommitdiffstats
path: root/github3/models/gists.py
diff options
context:
space:
mode:
Diffstat (limited to 'github3/models/gists.py')
-rw-r--r--github3/models/gists.py68
1 files changed, 48 insertions, 20 deletions
diff --git a/github3/models/gists.py b/github3/models/gists.py
index 5ad61c3..d1b416d 100644
--- a/github3/models/gists.py
+++ b/github3/models/gists.py
@@ -7,43 +7,71 @@ from .base import BaseResource
from .user import User
class File(BaseResource):
- _strs = ['filename', 'raw_url', 'content', 'language', 'type']
- _ints = ['size']
+ """ File model """
+
+ @classmethod
+ def idl(self):
+ return {
+ 'strs': ['filename', 'raw_url', 'content', 'language', 'type'],
+ 'ints': ['size'],
+ }
def __repr__(self):
return '<File gist> %s' % self.filename
class GistFork(BaseResource):
- _strs = ['url']
- _dates = ['created_at']
- _map = {'user': User}
+ """ GistFork model """
+
+ @classmethod
+ def idl(self):
+ return {
+ 'strs': ['url'],
+ 'dates': ['created_at'],
+ 'maps': {'user': User}
+ }
def __repr__(self):
return '<Gist fork> %s>' % self.user.login
class ChangeStatus(BaseResource):
- _ints = ['deletions', 'additions', 'total']
+ """ ChangeStatus model """
+
+ @classmethod
+ def idl(self):
+ return {
+ 'ints': ['deletions', 'additions', 'total'],
+ }
def __repr__(self):
return '<Gist history> change_status>'
class GistHistory(BaseResource):
- _strs = ['url', 'version']
- _map = {'user': User, 'change_status': ChangeStatus}
- _dates = ['committed_at']
+ """ """
+
+ @classmethod
+ def idl(self):
+ return {
+ 'strs': ['url', 'version'],
+ 'maps': {'user': User, 'change_status': ChangeStatus},
+ 'dates': ['committed_at'],
+ }
+
+ def __repr__(self):
+ return '<GistHistory %s/%s>' % (self.user, self.committed_at)
class Gist(BaseResource):
- _strs = ['url', 'description', 'html_url', 'git_pull_url', 'git_push_url']
- _ints = ['id', 'comments']
- _bools = ['public']
- _dates = ['created_at']
- _map = {'user': User}
- _list_map = {'files': File, 'forks': GistFork, 'history': GistHistory}
+ """ """
- @property
- def ri(self):
- return ('users', self.user.login, self.id)
+ @classmethod
+ def idl(self):
+ return {
+ 'strs': ['url', 'description', 'html_url', 'git_pull_url', 'git_push_url'],
+ 'ints': ['id', 'comments'],
+ 'bools': ['public'],
+ 'dates': ['created_at'],
+ 'maps': {'user': User},
+ 'collection_maps': {'files': File, 'forks': GistFork, 'history': GistHistory},
+ }
def __repr__(self):
- return '<gist %s/%s>' % (self.user.login, self.description)
-
+ return '<Gist %s/%s>' % (self.user, self.description)