module Github::Repos::Hooks

def create_hook(user_name=nil, repo_name=nil, params={})


}
}
"url" => "http://something.com/webhook"
"config" => {
"active" => true,
"name" => "web",
@github.repos.create_hook 'user-name', 'repo-name',
@github = Github.new
= Examples

* :active - Optional boolean - Determines whether the hook is actually triggered on pushes.
* :events - Optional array - Determines what events the hook is triggered for. Default: ["push"]
* :config - Required hash - A Hash containing key/value pairs to provide settings for this hook.
* :name - Required string - the name of the service that is being called.
= Inputs

Create a hook
def create_hook(user_name=nil, repo_name=nil, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _normalize_params_keys(params)
  _filter_params_keys(VALID_HOOK_PARAM_NAMES, params)
  raise ArgumentError, "Required parameters are: name, config" unless _validate_inputs(REQUIRED_PARAMS, params)
  post("/repos/#{user}/#{repo}/hooks", params)
end

def delete_hook(user_name, repo_name, hook_id, params={})


@github.repos.delete_hook 'user-name', 'repo-name', 'hook-id'
@github = Github.new
= Examples

Delete a hook
def delete_hook(user_name, repo_name, hook_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of hook_id
  _normalize_params_keys(params)
  delete("/repos/#{user}/#{repo}/hooks/#{hook_id}", params)
end

def edit_hook(user_name, repo_name, hook_id, params={})


}
"token" => "abc123"
"room" => "Commits",
"subdomain" => "github",
"config" => {
"active" => true,
"name" => "campfire",
@github.repos.edit_hook 'user-name', 'repo-name',
@github = Github.new
= Examples

* :active - Optional boolean - Determines whether the hook is actually triggered on pushes.
* :remove_events - Optional array - Determines a list of events to be removed from the list of events that the Hook triggers for.
* :add_events - Optional array - Determines a list of events to be added to the list of events that the Hook triggers for.
* :events - Optional array - Determines what events the hook is triggered for. This replaces the entire array of events. Default: ["push"].
* :config - Required hash - A Hash containing key/value pairs to provide settings for this hook.
* :name - Required string - the name of the service that is being called.
= Inputs

Edit a hook
def edit_hook(user_name, repo_name, hook_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of hook_id
  _normalize_params_keys(params)
  _filter_params_keys(VALID_HOOK_PARAM_NAMES, params)
  raise ArgumentError, "Required parameters are: name, config" unless _validate_inputs(REQUIRED_PARAMS, params)
  patch("/repos/#{user}/#{repo}/hooks/#{hook_id}", params)
end

def hook(user_name, repo_name, hook_id, params={})


@github.repos.hook 'user-name', 'repo-name'
@github = Github.new
= Examples

Get a single hook
def hook(user_name, repo_name, hook_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of hook_id
  _normalize_params_keys(params)
  get("/repos/#{user}/#{repo}/hooks/#{hook_id}", params)
end

def hooks(user_name=nil, repo_name=nil, params={})


@github.repos.hooks 'user-name', 'repo-name' { |hook| ... }
@github.repos.hooks 'user-name', 'repo-name'
@github = Github.new
= Examples

List repository hooks
def hooks(user_name=nil, repo_name=nil, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _normalize_params_keys(params)
  response = get("/repos/#{user}/#{repo}/hooks", params)
  return response unless block_given?
  response.each { |el| yield el }
end

def test_hook(user_name, repo_name, hook_id, params={})


@github.repos.test_hook 'user-name', 'repo-name', 'hook-id'
@github = Github.new
= Examples

This will trigger the hook with the latest push to the current repository.

Test a hook
def test_hook(user_name, repo_name, hook_id, params={})
  _update_user_repo_params(user_name, repo_name)
  _validate_user_repo_params(user, repo) unless user? && repo?
  _validate_presence_of hook_id
  _normalize_params_keys(params)
  post("/repos/#{user}/#{repo}/hooks/#{hook_id}/test", params)
end