Module: Octokit::Client::Hooks
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/octokit/client/hooks.rb |
Overview
Methods for the Hooks
API
Instance Method Summary
-
#create_hook(repo, name, config, options = {}) ⇒ Sawyer::Resource
Create a hook.
-
#create_org_hook(org, config, options = {}) ⇒ Sawyer::Resource
Create an org hook.
-
#edit_hook(repo, id, name, config, options = {}) ⇒ Sawyer::Resource
Edit a hook.
-
#edit_org_hook(org, id, config, options = {}) ⇒ Sawyer::Resource
(also: #update_org_hook)
Update an org hook.
-
#hook(repo, id, options = {}) ⇒ Sawyer::Resource
Get single hook.
-
#hooks(repo, options = {}) ⇒ Array<Sawyer::Resource>
List repo hooks.
-
#list_org_hooks(org, options = {})
Alias for #org_hooks.
-
#org_hook(org, id, options = {}) ⇒ Sawyer::Resource
Get an org hook.
-
#org_hooks(org, options = {}) ⇒ Array<Sawyer::Resource>
(also: #list_org_hooks)
List org hooks.
-
#parse_payload(payload_string) ⇒ Sawyer::Resource
Parse payload string.
-
#ping_hook(repo, id, options = {}) ⇒ Boolean
Ping hook.
-
#ping_org_hook(org, id, options = {}) ⇒ Boolean
Ping org hook.
-
#remove_hook(repo, id, options = {}) ⇒ Boolean
Delete hook.
-
#remove_org_hook(org, id, options = {}) ⇒ Boolean
Remove org hook.
-
#test_hook(repo, id, options = {}) ⇒ Boolean
Test hook.
-
#update_org_hook(org, id, config, options = {})
Alias for #edit_org_hook.
Instance Method Details
#create_hook(repo, name, config, options = {}) ⇒ Sawyer::Resource
Create a hook
Requires authenticated client.
# File 'lib/octokit/client/hooks.rb', line 65
def create_hook(repo, name, config, = {}) = { name: name, config: config, events: ['push'], active: true }.merge( ) post "#{Repository.path repo}/hooks", end
#create_org_hook(org, config, options = {}) ⇒ Sawyer::Resource
Create an org hook
Requires client authenticated as admin for the org.
# File 'lib/octokit/client/hooks.rb', line 209
def create_org_hook(org, config, = {}) = { name: 'web', config: config }.merge( ) post "#{Organization.path org}/hooks", end
#edit_hook(repo, id, name, config, options = {}) ⇒ Sawyer::Resource
Edit a hook
Requires authenticated client.
# File 'lib/octokit/client/hooks.rb', line 108
def edit_hook(repo, id, name, config, = {}) = { name: name, config: config }.merge( ) patch "#{Repository.path repo}/hooks/#{id}", end
#edit_org_hook(org, id, config, options = {}) ⇒ Sawyer::Resource
Also known as: #update_org_hook
Update an org hook
Requires client authenticated as admin for the org.
# File 'lib/octokit/client/hooks.rb', line 242
def edit_org_hook(org, id, config, = {}) = { config: config }.merge( ) patch "#{Organization.path org}/hooks/#{id}", end
#hook(repo, id, options = {}) ⇒ Sawyer::Resource
Get single hook
Requires authenticated client.
# File 'lib/octokit/client/hooks.rb', line 30
def hook(repo, id, = {}) get "#{Repository.path repo}/hooks/#{id}", end
#hooks(repo, options = {}) ⇒ Array
<Sawyer::Resource
>
List repo hooks
Requires authenticated client.
# File 'lib/octokit/client/hooks.rb', line 16
def hooks(repo, = {}) paginate "#{Repository.path repo}/hooks", end
#list_org_hooks(org, options = {})
Alias for #org_hooks.
# File 'lib/octokit/client/hooks.rb', line 167
alias list_org_hooks org_hooks
#org_hook(org, id, options = {}) ⇒ Sawyer::Resource
Get an org hook
Requires client authenticated as admin for the org.
# File 'lib/octokit/client/hooks.rb', line 179
def org_hook(org, id, = {}) get "#{Organization.path org}/hooks/#{id}", end
#org_hooks(org, options = {}) ⇒ Array
<Sawyer::Resource
>
Also known as: #list_org_hooks
List org hooks
Requires client authenticated as admin for the org.
# File 'lib/octokit/client/hooks.rb', line 164
def org_hooks(org, = {}) paginate "#{Organization.path org}/hooks", end
#parse_payload(payload_string) ⇒ Sawyer::Resource
Parse payload string
# File 'lib/octokit/client/hooks.rb', line 281
def parse_payload(payload_string) payload_hash = agent.class.decode payload_string Sawyer::Resource.new agent, payload_hash end
#ping_hook(repo, id, options = {}) ⇒ Boolean
Ping hook
Requires authenticated client.
# File 'lib/octokit/client/hooks.rb', line 151
def ping_hook(repo, id, = {}) boolean_from_response :post, "#{Repository.path repo}/hooks/#{id}/pings", end
#ping_org_hook(org, id, options = {}) ⇒ Boolean
Ping org hook
Requires client authenticated as admin for the org.
# File 'lib/octokit/client/hooks.rb', line 258
def ping_org_hook(org, id, = {}) boolean_from_response :post, "#{Organization.path org}/hooks/#{id}/pings", end
#remove_hook(repo, id, options = {}) ⇒ Boolean
Delete hook
Requires authenticated client.
# File 'lib/octokit/client/hooks.rb', line 123
def remove_hook(repo, id, = {}) boolean_from_response :delete, "#{Repository.path repo}/hooks/#{id}", end
#remove_org_hook(org, id, options = {}) ⇒ Boolean
Remove org hook
Requires client authenticated as admin for the org.
# File 'lib/octokit/client/hooks.rb', line 272
def remove_org_hook(org, id, = {}) boolean_from_response :delete, "#{Organization.path org}/hooks/#{id}", end
#test_hook(repo, id, options = {}) ⇒ Boolean
Test hook
Requires authenticated client.
# File 'lib/octokit/client/hooks.rb', line 137
def test_hook(repo, id, = {}) boolean_from_response :post, "#{Repository.path repo}/hooks/#{id}/tests", end
#update_org_hook(org, id, config, options = {})
Alias for #edit_org_hook.
# File 'lib/octokit/client/hooks.rb', line 246
alias update_org_hook edit_org_hook