aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3/services
diff options
context:
space:
mode:
authorStefano Rivera <stefano@rivera.za.net>2012-04-23 17:44:10 +0200
committerStefano Rivera <stefano@rivera.za.net>2012-04-23 17:44:10 +0200
commitc7c03100fd0584b759bb75d461a12f5bcd5aabba (patch)
tree16267d3fb9919933d826ddcc8aa05f04b9b0a00f /pygithub3/services
parent:sparkles: Release 0.3 :sparkles: (diff)
downloadpython-github3-c7c03100fd0584b759bb75d461a12f5bcd5aabba.tar.xz
python-github3-c7c03100fd0584b759bb75d461a12f5bcd5aabba.zip
Baseline Orgs API implementation
Diffstat (limited to 'pygithub3/services')
-rw-r--r--pygithub3/services/orgs/__init__.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/pygithub3/services/orgs/__init__.py b/pygithub3/services/orgs/__init__.py
new file mode 100644
index 0000000..28f6b16
--- /dev/null
+++ b/pygithub3/services/orgs/__init__.py
@@ -0,0 +1,51 @@
+# -*- encoding: utf-8 -*-
+
+from pygithub3.services.base import Service
+
+
+class Org(Service):
+ """ Consume `Orgs API <http://developer.github.com/v3/orgs>`_ """
+
+ 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, name):
+ """ Get a single org
+
+ :param str name: Org name
+ """
+ request = self.request_builder('orgs.get', name=name)
+ return self._get(request)
+
+ def update(self, name, data):
+ """ Update a single org
+
+ :param str name: 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', name=name, body=data)
+ return self._patch(request)