@@ -77,32 +77,48 @@ def __repr__(self):
7777class User (BaseResource ):
7878 """Github User object model."""
7979
80- _strings = [
80+ _strs = [
8181 'login' ,'gravatar_url' , 'url' , 'name' , 'company' , 'blog' , 'location' ,
8282 'email' , 'bio' , 'html_url' ]
8383
8484 _ints = ['id' , 'public_repos' , 'public_gists' , 'followers' , 'following' ]
8585 _dates = ['created_at' ,]
8686 _bools = ['hireable' , ]
87- _map = {}
88- _writeable = []
87+ # _map = {}
88+ # _writeable = []
8989
9090 def __repr__ (self ):
9191 return '<user {0}>' .format (self .login )
9292
93+ def repos (self ):
94+ # return self._gh.get_repos(username=self.login)
95+ repos = self ._gh ._get_resources (('users' , self .login , 'repos' ), Repo , authed = False )
96+ return repos
9397
94- class CurrentUser (BaseResource ):
95- """Github Current User object model."""
9698
97- _strings = [
98- 'login' ,'gravatar_url' , 'url' , 'name' , 'company' , 'blog' , 'location' ,
99- 'email' , 'bio' , 'html_url' ]
99+ class CurrentUser (User ):
100+ """Github Current User object model."""
100101
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' , ]
102+ _ints = [
103+ 'id' , 'public_repos' , 'public_gists' , 'followers' , 'following' ,
104+ 'total_private_repos' , 'owned_private_repos' , 'private_gists' ,
105+ 'disk_usage' , 'collaborators' ]
104106 _map = {'plan' : Plan }
105107 _writeable = ['name' , 'email' , 'blog' , 'company' , 'location' , 'hireable' , 'bio' ]
106108
107109 def __repr__ (self ):
108110 return '<current-user {0}>' .format (self .login )
111+
112+
113+ class Repo (BaseResource ):
114+ _strs = [
115+ 'url' , 'html_url' , 'clone_url' , 'git_url' , 'ssh_url' , 'svn_url' ,
116+ 'name' , 'description' , 'homepage' , 'language' , 'master_branch' ]
117+ _bools = ['private' , 'fork' ]
118+ _ints = ['forks' , 'watchers' , 'size' ,]
119+ _dates = ['pushed_at' , 'created_at' ]
120+ _map = {'owner' : User }
121+
122+ def __repr__ (self ):
123+ return '<repo {0}/{1}>' .format (self .owner .login , self .name )
124+ # owner
0 commit comments