Method: Gitlab::Client::SystemHooks#add_hook

Defined in:
lib/gitlab/client/system_hooks.rb

#add_hook(url, options = {}) ⇒ Gitlab::ObjectifiedHash Also known as: add_system_hook

Adds a new system hook.

Examples:

Gitlab.add_hook('http://example.com/hook')
Gitlab.add_system_hook('https://api.example.net/v1/hook')

Parameters:

  • url (String)

    The hook URL.

  • options (Hash) (defaults to: {})

    Additional options, as allowed by Gitlab API, including but not limited to:

Options Hash (options):

  • :token (String)

    A secret token for Gitlab to send in the ‘X-Gitlab-Token` header for authentication.

  • :enable_ssl_verification (boolean)

    ‘false` will cause Gitlab to ignore invalid/unsigned certificate errors (default is `true`)

Returns:

[View source]

33
34
35
# File 'lib/gitlab/client/system_hooks.rb', line 33

def add_hook(url, options = {})
  post('/hooks', body: options.merge(url: url))
end