aboutsummaryrefslogtreecommitdiffstats
path: root/github3/handlers/gists.py
blob: 38418ca4b1505f82ea6b9ccbc668b7cbca5d82e1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python
# -*- encoding: utf-8 -*-

from .base import Handler
from .. import models


class Gist(Handler):
    """ Gist handler """

    prefix = 'gists'

    def __repr__(self):
        return '<Gist handler>'

    def get(self, gist_id):
        """ Return gist """

        return self._get_resource(gist_id, model=models.Gist)


class AuthGist(Gist):

    def create_gist(self, description, public=True, files={}):
        """ Create a gist """
        data = {'description': description,
                'public': public,
                'files': files}
        return self._post_resource('', data=data, model=models.Gist)