aboutsummaryrefslogtreecommitdiffstats
path: root/github3/models
diff options
context:
space:
mode:
authorDavid Medina <davidmedina9@gmail.com>2012-02-03 02:59:53 +0100
committerDavid Medina <davidmedina9@gmail.com>2012-02-03 02:59:53 +0100
commitae1c3c06c47866c8f392d05c63f597d71cebd691 (patch)
tree6543c55e2210bd91f59124785200d1fbfb6be872 /github3/models
parentUpdate setup.py (diff)
downloadpython-github3-ae1c3c06c47866c8f392d05c63f597d71cebd691.tar.xz
python-github3-ae1c3c06c47866c8f392d05c63f597d71cebd691.zip
Reset project
Diffstat (limited to 'github3/models')
-rw-r--r--github3/models/__init__.py4
-rw-r--r--github3/models/base.py18
-rw-r--r--github3/models/gists.py98
-rw-r--r--github3/models/orgs.py23
-rw-r--r--github3/models/repos.py29
-rw-r--r--github3/models/user.py69
6 files changed, 0 insertions, 241 deletions
diff --git a/github3/models/__init__.py b/github3/models/__init__.py
deleted file mode 100644
index 0471393..0000000
--- a/github3/models/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-from .user import AuthUser, User, Key
-from .repos import Repo
-from .orgs import Org
-from .gists import Gist, GistComment
diff --git a/github3/models/base.py b/github3/models/base.py
deleted file mode 100644
index 5295d07..0000000
--- a/github3/models/base.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-
-class BaseResource(object):
- """A BaseResource object."""
-
- def __init__(self, attrs=None):
- if attrs:
- for attr, value in attrs.items():
- setattr(self, attr, value)
- super(BaseResource, self).__init__()
-
- def __len__(self):
- return len(self.__dict__)
-
- @classmethod
- def idl(self):
- raise NotImplementedError('Each model need subcass that method')
diff --git a/github3/models/gists.py b/github3/models/gists.py
deleted file mode 100644
index 8979dbb..0000000
--- a/github3/models/gists.py
+++ /dev/null
@@ -1,98 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-
-from .base import BaseResource
-from .user import User
-
-
-class GistComment(BaseResource):
- """ Gist comment """
-
- @classmethod
- def idl(self):
- return {
- 'strs': ['url', 'body', 'body_text', 'body_html'],
- 'ints': ['id'],
- 'maps': {'user': User},
- 'dates': ['created_at'],
- }
-
- def __repr__(self):
- return '<GistComment %s>' % self.user.login
-
-
-class File(BaseResource):
- """ 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):
- """ 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):
- """ ChangeStatus model """
-
- @classmethod
- def idl(self):
- return {
- 'ints': ['deletions', 'additions', 'total'],
- }
-
- def __repr__(self):
- return '<Gist history> 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 '<GistHistory %s/%s>' % (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 '<Gist %s/%s>' % (self.user, self.description)
diff --git a/github3/models/orgs.py b/github3/models/orgs.py
deleted file mode 100644
index b2dacbd..0000000
--- a/github3/models/orgs.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-
-from .base import BaseResource
-from .user import Plan
-
-class Org(BaseResource):
- """Github Organization object model."""
-
- @classmethod
- def idl(self):
- return {
- 'strs': ['login', 'url', 'avatar_url', 'name', 'company', 'blog',
- 'location', 'email', 'html_url', 'type', 'billing_email'],
- 'ints': ['id', 'public_repos', 'public_gists', 'followers',
- 'following', 'total_private_repos', 'owned_private_repos',
- 'private_gists', 'disk_usage', 'collaborators'],
- 'dates': ['created_at'],
- 'maps': {'plan': Plan}
- }
-
- def __repr__(self):
- return '<Org %s>' % self.login
diff --git a/github3/models/repos.py b/github3/models/repos.py
deleted file mode 100644
index 882fb37..0000000
--- a/github3/models/repos.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-
-from .base import BaseResource
-from .user import User
-from .orgs import Org
-
-class Repo(BaseResource):
- """ Repo model """
-
- @classmethod
- def idl(self):
- return {
- 'strs': [
- 'url', 'html_url', 'clone_url', 'git_url', 'ssh_url', 'svn_url',
- 'name', 'description', 'homepage', 'language', 'master_branch'],
- 'ints': ['forks', 'watchers', 'size', 'open_issues'],
- 'dates': ['created_at', 'pushed_at'],
- 'bools': ['private', 'fork', 'has_issues', 'has_wiki', 'has_downloads'],
- 'maps': {
- 'owner': User,
- 'organization': Org,
- 'parent': self.__class__,
- 'source': self.__class__,
- }
- }
-
- def __repr__(self):
- return '<Repo %s/%s>' % (self.owner.login, self.name)
diff --git a/github3/models/user.py b/github3/models/user.py
deleted file mode 100644
index aed6f09..0000000
--- a/github3/models/user.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-
-from .base import BaseResource
-
-
-class Plan(BaseResource):
- """Github Plan object model."""
-
- @classmethod
- def idl(self):
- return {
- 'strs': ['name'],
- 'ints': ['space', 'collaborators', 'private_repos'],
- }
-
- def __repr__(self):
- return '<Plan %s>' % self.name
-
-
-class Key(BaseResource):
- """Github Key object model."""
-
- @classmethod
- def idl(self):
- return {
- 'strs': ['url', 'title', 'key'],
- 'ints': ['id'],
- }
-
- def __repr__(self):
- return '<Key %s>' % self.title
-
-
-class User(BaseResource):
- """Github User object model."""
-
- @classmethod
- def idl(self):
- return {
- 'strs': [
- 'login', 'avatar_url', 'gravatar_id', 'url', 'name',
- 'company', 'blog', 'location', 'email', 'bio', 'html_url',
- 'type'],
- 'ints': [
- 'id', 'public_repos', 'public_gists', 'followers', 'following',
- 'total_private_repos', 'owned_private_repos', 'private_gists',
- 'disk_usage', 'collaborators'],
- 'maps': {'plan': Plan},
- 'dates': ['created_at', ],
- 'bools': ['hireable', ],
- }
-
- def __repr__(self):
- return '<User %s>' % getattr(self, 'login', 'without user')
-
- #def handler(self):
- # return self._gh.users
-
-
-class AuthUser(User):
- """Github Authenticated User object model."""
-
- def __repr__(self):
- return '<AuthUser %s>' % self.login
-
- #def handler(self):
- # return self._gh.users
-