@@ -17,6 +17,7 @@ class BaseResource(object):
1717 _bools = []
1818 _map = {}
1919 _writeable = []
20+ _modified = []
2021
2122
2223 def __init__ (self ):
@@ -47,10 +48,11 @@ def new_from_dict(cls, d, gh=None):
4748
4849 return to_python (
4950 obj = cls (), in_dict = d ,
50- str_keys = cls ._strings ,
51+ str_keys = cls ._strs ,
5152 int_keys = cls ._ints ,
52- date_keys = cls ._datetimes ,
53- bool_keys = cls ._booleans ,
53+ date_keys = cls ._dates ,
54+ bool_keys = cls ._bools ,
55+ object_map = cls ._map ,
5456 _gh = gh
5557 )
5658
@@ -61,6 +63,17 @@ def setattr(self, k, v):
6163 # TODO: when writable key changed,
6264 pass
6365
66+ class Plan (BaseResource ):
67+ """Github Plan object model."""
68+
69+ _strs = ['name' ]
70+ _ints = ['space' , 'collaborators' , 'private_repos' ]
71+
72+ def __repr__ (self ):
73+ return '<plan {0}>' .format (str (self .name ))
74+
75+
76+
6477class User (BaseResource ):
6578 """Github User object model."""
6679
@@ -69,31 +82,43 @@ class User(BaseResource):
6982 'email' , 'bio' , 'html_url' ]
7083
7184 _ints = ['id' , 'public_repos' , 'public_gists' , 'followers' , 'following' ]
72- _datetimes = ['created_at' ,]
73- _booleans = ['hireable' , ]
85+ _dates = ['created_at' ,]
86+ _bools = ['hireable' , ]
7487 _map = {}
7588 _writeable = ['name' , 'email' , 'blog' , 'company' , 'location' , 'hireable' , 'bio' ]
7689
90+ def __repr__ (self ):
91+ return '<user {0}>' .format (self .login )
7792
78- def __init__ (self ):
79- super (User , self ).__init__ ()
93+
94+ class User (BaseResource ):
95+ """Github User object model."""
96+
97+ _strings = [
98+ 'login' ,'gravatar_url' , 'url' , 'name' , 'company' , 'blog' , 'location' ,
99+ 'email' , 'bio' , 'html_url' ]
100+
101+ _ints = ['id' , 'public_repos' , 'public_gists' , 'followers' , 'following' , 'total_private_repos' , 'owned_private_repos' , 'private_gists' , 'disk_usage' , 'collaborators' ]
102+ _dates = ['created_at' ,]
103+ _bools = ['hireable' , ]
104+ _map = {'plan' : Plan }
105+ _writeable = ['name' , 'email' , 'blog' , 'company' , 'location' , 'hireable' , 'bio' ]
80106
81107 def __repr__ (self ):
82108 return '<user {0}>' .format (self .login )
83109
110+ # def _update(self):
111+ # """Update the User."""
84112
85- def _update (self ):
86- """Update the User."""
87-
88- args = to_api (
89- dict (
90- favorite = self .favorite ,
91- archive = self .archive ,
92- read_percent = self .read_percent ,
93- ),
94- int_keys = ('favorite' , 'archive' )
95- )
113+ # args = to_api(
114+ # dict(
115+ # favorite=self.favorite,
116+ # archive=self.archive,
117+ # read_percent=self.read_percent,
118+ # ),
119+ # int_keys=('favorite', 'archive')
120+ # )
96121
97- r = self ._rdd ._post_resource (('bookmarks' , self .id ), ** args )
122+ # r = self._rdd._post_resource(('bookmarks', self.id), **args)
98123
99- return r
124+ # return r
0 commit comments