diff options
Diffstat (limited to 'lib/gitlab_net.rb')
-rw-r--r-- | lib/gitlab_net.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb index 3acebea..b48f655 100644 --- a/lib/gitlab_net.rb +++ b/lib/gitlab_net.rb @@ -11,6 +11,7 @@ require_relative 'httpunix' class GitlabNet class ApiUnreachableError < StandardError; end + class NotFound < StandardError; end CHECK_TIMEOUT = 5 READ_TIMEOUT = 300 @@ -112,6 +113,19 @@ class GitlabNet false end + def post_receive(gl_repository, identifier, changes) + params = { + gl_repository: gl_repository, + identifier: identifier, + changes: changes + } + resp = post("#{host}/post_receive", params) + + raise NotFound if resp.code == '404' + + JSON.parse(resp.body) if resp.code == '200' + end + def redis_client redis_config = config.redis database = redis_config['database'] || 0 |