diff options
Diffstat (limited to 'pygithub3/resources/gists.py')
-rw-r--r-- | pygithub3/resources/gists.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/pygithub3/resources/gists.py b/pygithub3/resources/gists.py new file mode 100644 index 0000000..7e9550a --- /dev/null +++ b/pygithub3/resources/gists.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- + +from .base import Resource +from .users import User + + +class File(Resource): + + def __str__(self): + return '<GistFile (%s)>' % getattr(self, 'filename', '') + + +class Fork(Resource): + + _dates = ('created_at', ) + _maps = {'user': User} + def __str__(self): + return '<GistFork>' + + +class History(Resource): + + _dates = ('committed_at', ) + _maps = {'user': User} + + def __str__(self): + return '<GistHistory (%s)>' % getattr(self, 'version', '') + +class Gist(Resource): + + _dates = ('created_at', ) + _maps = {'user': User} + _collection_maps = {'files': File, 'forks': Fork, 'history': History} + + def __str__(self): + return '<Gist (%s)>' % getattr(self, 'description', '') + +class Comment(Resource): + + _dates = ('created_at', ) + _maps = {'user': User} + + def __str__(self): + return '<GistComment (%s)>' % getattr(self, 'user', '') |