Module: Octokit::Client::Hooks
- Included in:
- Octokit::Client
- Defined in:
- lib/octokit/client/hooks.rb
Overview
Methods for the Hooks API
Instance Method Summary collapse
-
#available_hooks(options = {}) ⇒ Sawyer::Resource
List all Service Hooks supported by GitHub.
-
#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.
-
#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.
Instance Method Details
#available_hooks(options = {}) ⇒ Sawyer::Resource
List all Service Hooks supported by GitHub
13 14 15 |
# File 'lib/octokit/client/hooks.rb', line 13 def available_hooks( = {}) get "hooks", end |
#create_hook(repo, name, config, options = {}) ⇒ Sawyer::Resource
Create a hook
Requires authenticated client.
75 76 77 78 |
# File 'lib/octokit/client/hooks.rb', line 75 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.
219 220 221 222 |
# File 'lib/octokit/client/hooks.rb', line 219 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.
118 119 120 121 |
# File 'lib/octokit/client/hooks.rb', line 118 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.
252 253 254 255 |
# File 'lib/octokit/client/hooks.rb', line 252 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.
40 41 42 |
# File 'lib/octokit/client/hooks.rb', line 40 def hook(repo, id, = {}) get "#{Repository.path repo}/hooks/#{id}", end |
#hooks(repo, options = {}) ⇒ Array<Sawyer::Resource>
List repo hooks
Requires authenticated client.
26 27 28 |
# File 'lib/octokit/client/hooks.rb', line 26 def hooks(repo, = {}) paginate "#{Repository.path repo}/hooks", end |
#org_hook(org, id, options = {}) ⇒ Sawyer::Resource
Get an org hook
Requires client authenticated as admin for the org.
189 190 191 |
# File 'lib/octokit/client/hooks.rb', line 189 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.
174 175 176 |
# File 'lib/octokit/client/hooks.rb', line 174 def org_hooks(org, = {}) paginate "#{Organization.path org}/hooks", end |
#parse_payload(payload_string) ⇒ Sawyer::Resource
Parse payload string
291 292 293 294 |
# File 'lib/octokit/client/hooks.rb', line 291 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.
161 162 163 |
# File 'lib/octokit/client/hooks.rb', line 161 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.
268 269 270 |
# File 'lib/octokit/client/hooks.rb', line 268 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.
133 134 135 |
# File 'lib/octokit/client/hooks.rb', line 133 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.
282 283 284 |
# File 'lib/octokit/client/hooks.rb', line 282 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.
147 148 149 |
# File 'lib/octokit/client/hooks.rb', line 147 def test_hook(repo, id, = {}) boolean_from_response :post, "#{Repository.path repo}/hooks/#{id}/tests", end |