@@ -257,6 +257,23 @@ def gist(self, id_num):
257257 json = self ._json (self ._get (url ), 200 )
258258 return Gist (json , self ) if json else None
259259
260+ def gitignore_template (self , language ):
261+ """Returns the template for language.
262+
263+ :returns: str
264+ """
265+ url = self ._build_url ('gitignore' , 'templates' , language )
266+ json = self ._json (self ._get (url ), 200 )
267+ return json .get ('source' , '' )
268+
269+ def gitignore_templates (self ):
270+ """Returns the list of available templates.
271+
272+ :returns: list of template names
273+ """
274+ url = self ._build_url ('gitignore' , 'templates' )
275+ return self ._json (self ._get (url ), 200 ) or []
276+
260277 @requires_auth
261278 def is_following (self , login ):
262279 """Check if the authenticated user is following login.
@@ -312,19 +329,6 @@ def issue(self, owner, repository, number):
312329 return repo .issue (number )
313330 return None
314331
315- @requires_auth
316- def key (self , id_num ):
317- """Gets the authenticated user's key specified by id_num.
318-
319- :param int id_num: (required), unique id of the key
320- :returns: :class:`Key <github3.users.Key>`
321- """
322- json = None
323- if int (id_num ) > 0 :
324- url = self ._build_url ('user' , 'keys' , str (id_num ))
325- json = self ._json (self ._get (url ), 200 )
326- return Key (json , self ) if json else None
327-
328332 @requires_basic_auth
329333 def iter_authorizations (self , number = - 1 ):
330334 """Iterate over authorizations for the authenticated user. This will
@@ -631,6 +635,19 @@ def iter_subscriptions(self, login=None, number=-1):
631635 url = self ._build_url ('user' , 'subscriptions' )
632636 return self ._iter (int (number ), url , Repository )
633637
638+ @requires_auth
639+ def key (self , id_num ):
640+ """Gets the authenticated user's key specified by id_num.
641+
642+ :param int id_num: (required), unique id of the key
643+ :returns: :class:`Key <github3.users.Key>`
644+ """
645+ json = None
646+ if int (id_num ) > 0 :
647+ url = self ._build_url ('user' , 'keys' , str (id_num ))
648+ json = self ._json (self ._get (url ), 200 )
649+ return Key (json , self ) if json else None
650+
634651 def login (self , username = None , password = None , token = None ):
635652 """Logs the user into GitHub for protected API calls.
636653
0 commit comments