diff options
| author | 2012-05-27 21:39:03 +0200 | |
|---|---|---|
| committer | 2012-06-03 14:47:23 +0200 | |
| commit | 9dedea7efc93c542d8088435fd45891626bc791b (patch) | |
| tree | fdad343826fd3eeeb9de2fa75f5bf90b085ea92e /pygithub3/services/orgs/__init__.py | |
| parent | Merge pull request #11 from dsc/patch-1 (diff) | |
| parent | Authors updated (diff) | |
| download | python-github3-9dedea7efc93c542d8088435fd45891626bc791b.tar.xz python-github3-9dedea7efc93c542d8088435fd45891626bc791b.zip | |
Merge #5 'services/orgs'
Diffstat (limited to 'pygithub3/services/orgs/__init__.py')
| -rw-r--r-- | pygithub3/services/orgs/__init__.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/pygithub3/services/orgs/__init__.py b/pygithub3/services/orgs/__init__.py new file mode 100644 index 0000000..8499719 --- /dev/null +++ b/pygithub3/services/orgs/__init__.py @@ -0,0 +1,58 @@ +# -*- encoding: utf-8 -*- + +from pygithub3.services.base import Service +from .members import Members +from .teams import Teams + + +class Org(Service): + """ Consume `Orgs API <http://developer.github.com/v3/orgs>`_ """ + + def __init__(self, **config): + self.members = Members(**config) + self.teams = Teams(**config) + super(Org, self).__init__(**config) + + def list(self, user=None): + """ Get user's orgs + + :param str user: Username + :returns: A :doc:`result` + + If you call it without user and you are authenticated, get the + authenticated user's orgs, public and private. + + If you call it with a user, get the user's public orgs. + + :: + + org_service.list('copitux') + org_service.list() + """ + request = self.request_builder('orgs.list', user=user) + return self._get_result(request) + + def get(self, org): + """ Get a single org + + :param str org: Org name + """ + request = self.request_builder('orgs.get', org=org) + return self._get(request) + + def update(self, org, data): + """ Update a single org + + :param str org: Org name + :param dict data: Input. See `github orgs doc`_ + + .. warning :: + You must be authenticated + + :: + + org_service.update(dict(company='ACME Development', + location='Timbuctoo')) + """ + request = self.request_builder('orgs.update', org=org, body=data) + return self._patch(request) |
