From ed34830ab64837d16b2943887045a44f0760ee8e Mon Sep 17 00:00:00 2001 From: David Medina Date: Wed, 9 Nov 2011 00:35:13 +0100 Subject: New design. Merge develop branch --- github3/models/gists.py | 77 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 github3/models/gists.py (limited to 'github3/models/gists.py') diff --git a/github3/models/gists.py b/github3/models/gists.py new file mode 100644 index 0000000..d1b416d --- /dev/null +++ b/github3/models/gists.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- +# +# author: David Medina + +from .base import BaseResource +from .user import User + +class File(BaseResource): + """ File model """ + + @classmethod + def idl(self): + return { + 'strs': ['filename', 'raw_url', 'content', 'language', 'type'], + 'ints': ['size'], + } + + def __repr__(self): + return ' %s' % self.filename + +class GistFork(BaseResource): + """ GistFork model """ + + @classmethod + def idl(self): + return { + 'strs': ['url'], + 'dates': ['created_at'], + 'maps': {'user': User} + } + + def __repr__(self): + return ' %s>' % self.user.login + +class ChangeStatus(BaseResource): + """ ChangeStatus model """ + + @classmethod + def idl(self): + return { + 'ints': ['deletions', 'additions', 'total'], + } + + def __repr__(self): + return ' change_status>' + +class GistHistory(BaseResource): + """ """ + + @classmethod + def idl(self): + return { + 'strs': ['url', 'version'], + 'maps': {'user': User, 'change_status': ChangeStatus}, + 'dates': ['committed_at'], + } + + def __repr__(self): + return '' % (self.user, self.committed_at) + +class Gist(BaseResource): + """ """ + + @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 '' % (self.user, self.description) -- cgit v1.2.3-59-g8ed1b