diff options
author | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-08-30 19:31:24 -0300 |
---|---|---|
committer | Alejandro RodrÃguez <alejorro70@gmail.com> | 2017-08-30 19:31:24 -0300 |
commit | 58df68e34e89d21884f0374ff969d742009998a4 (patch) | |
tree | b0e0452c6934ce5014124c58d2819fed15289bfd /lib/gitlab_net.rb | |
parent | e358cf251a1916284033c4af6f9c75495ad1e2a7 (diff) | |
download | gitlab-shell-58df68e34e89d21884f0374ff969d742009998a4.tar.gz |
Support new /internal/post-receive API endpoint
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 |