Sha256: e377d145515a6b8fcee89012b4fe42a9aa05b6fa53f9adfb266000434795a9c3
Contents?: true
Size: 1.71 KB
Versions: 3
Compression:
Stored size: 1.71 KB
Contents
# encoding: utf-8 module Github class Repos module Hooks REQUIRED_PARAMS = %w[ name config ] # List repository hooks # # GET /repos/:user/:repo/hooks # def hooks(user, repo) get("/repos/#{user}/#{repo}/hooks") end # Get a single hook # # GET /repos/:user/:repo/hooks/:id # def get_hook(user, repo, hook_id) get("/repos/#{user}/#{repo}/hooks/#{hook_id}") end # Create a hook # # POST /repos/:user/:repo/hooks # def create_hook(user, repo, params) _normalize_params_keys(params) _filter_params_keys(%w[ name config active ], params) raise ArgumentError, "Required parameters are: #{REQUIRED_PARAMS.join(', ')}" unless _validate_inputs(REQUIRED_PARAMS, params) post("/repos/#{user}/#{repo}/hooks", params) end # Edit a hook # # PATCH /repos/:user/:repo/hooks/:id # def edit_hook(user, repo, hook_id, params) _normalize_params_keys(params) _filter_params_keys(%w[ name config active ], params) raise ArgumentError, "Required parameters are: #{REQUIRED_PARAMS.join(', ')}" unless _validate_inputs(REQUIRED_PARAMS, params) patch("/repos/#{user}/#{repo}/hooks/#{hook_id}") end # Test a hook # # POST /repos/:user/:repo/hooks/:id/test # def test_hook(user, repo, hook_id) post("/repos/#{user}/#{repo}/hooks/#{hook_id}/test") end # Delete a hook # # DELETE /repos/:user/:repo/hooks/:id # def delete_hook(user, repo, hook_id) delete("/repos/#{user}/#{repo}/hooks/#{hook_id}") end end # Hooks end # Repos end # Github
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
github_api-0.1.1 | lib/github_api/repos/hooks.rb |
github_api-0.1.0 | lib/github_api/repos/hooks.rb |
github_api-0.1.0.pre | lib/github_api/repos/hooks.rb |