aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3/requests/users/user.py
blob: d4b3667003e6fd353f50eb32bb1be009a0e23fb3 (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
30
31
32
33
34
35
36
#!/usr/bin/env python
# -*- encoding: utf-8 -*-

from . import Request, json
from pygithub3.resources.users import User

__all__ = ('Get', 'Update')


class Get(Request):

    resource = User

    def validate(self):
        pass

    def set_uri(self):
        if self.user:
            return 'users/%s' % self.user
        else:
            return 'user'


class Update(Request):

    resource = User
    valid = ('name', 'email', 'blog', 'company', 'location', 'hireable', 'bio')

    def validate(self):
        self.update_params = self._parse_simple_dict(self.update_with)

    def get_data(self):
        return json.dumps(self.update_params)

    def set_uri(self):
        return 'user'