@@ -81,8 +81,10 @@ class Gitlab(object):
8181 builds
8282 project_commits (ProjectCommitManager): Manager for GitLab projects
8383 commits
84- project_commitcomments (ProjectCommitCommentManager): Manager for
84+ project_commit_comments (ProjectCommitCommentManager): Manager for
8585 GitLab projects commits comments
86+ project_commit_statuses (ProjectCommitStatusManager): Manager for
87+ GitLab projects commits statuses
8688 project_keys (ProjectKeyManager): Manager for GitLab projects keys
8789 project_events (ProjectEventManager): Manager for GitLab projects
8890 events
@@ -157,6 +159,7 @@ def __init__(self, url, private_token=None, email=None, password=None,
157159 self .project_builds = ProjectBuildManager (self )
158160 self .project_commits = ProjectCommitManager (self )
159161 self .project_commit_comments = ProjectCommitCommentManager (self )
162+ self .project_commit_statuses = ProjectCommitStatusManager (self )
160163 self .project_keys = ProjectKeyManager (self )
161164 self .project_events = ProjectEventManager (self )
162165 self .project_forks = ProjectForkManager (self )
@@ -242,14 +245,24 @@ def set_url(self, url):
242245 """
243246 self ._url = '%s/api/v3' % url
244247
245- def _construct_url (self , id_ , obj , parameters ):
248+ def _construct_url (self , id_ , obj , parameters , action = None ):
246249 if 'next_url' in parameters :
247250 return parameters ['next_url' ]
248251 args = _sanitize (parameters )
252+
253+ url_attr = '_url'
254+ if action is not None :
255+ attr = '_%s_url' % action
256+ if hasattr (obj , attr ):
257+ url_attr = attr
258+ obj_url = getattr (obj , url_attr )
259+
260+ # TODO(gpocentek): the following will need an update when we have
261+ # object with both urlPlural and _ACTION_url attributes
249262 if id_ is None and obj ._urlPlural is not None :
250263 url = obj ._urlPlural % args
251264 else :
252- url = obj . _url % args
265+ url = obj_url % args
253266
254267 if id_ is not None :
255268 url = '%s%s/%s' % (self ._url , url , str (id_ ))
@@ -589,7 +602,8 @@ def create(self, obj, **kwargs):
589602 raise GitlabCreateError ('Missing attribute(s): %s' %
590603 ", " .join (missing ))
591604
592- url = self ._construct_url (id_ = None , obj = obj , parameters = params )
605+ url = self ._construct_url (id_ = None , obj = obj , parameters = params ,
606+ action = 'create' )
593607 headers = self ._create_headers (content_type = "application/json" )
594608
595609 # build data that can really be sent to server
0 commit comments