Class: Gitea::RepoHooksResource
- Defined in:
- lib/gitea/resources/repo_hooks.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
- #create(owner:, repo:, url:, type:, **args) ⇒ Object
- #delete(owner:, repo:, id:) ⇒ Object
- #get(owner:, repo:, id:) ⇒ Object
- #list(owner:, repo:, **params) ⇒ Object
- #test(owner:, repo:, id:) ⇒ Object
- #update(owner:, repo:, id:, **args) ⇒ Object
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Gitea::Resource
Instance Method Details
#create(owner:, repo:, url:, type:, **args) ⇒ Object
13 14 15 16 |
# File 'lib/gitea/resources/repo_hooks.rb', line 13 def create(owner:, repo:, url:, type:, **args) data = {config: {content_type: "json", url: url}, type: type} Hook.new post_request("repos/#{owner}/#{repo}/hooks", body: args.merge(data)).body end |
#delete(owner:, repo:, id:) ⇒ Object
26 27 28 |
# File 'lib/gitea/resources/repo_hooks.rb', line 26 def delete(owner:, repo:, id:) delete_request("repos/#{owner}/#{repo}/hooks/#{id}") end |
#get(owner:, repo:, id:) ⇒ Object
9 10 11 |
# File 'lib/gitea/resources/repo_hooks.rb', line 9 def get(owner:, repo:, id:) Hook.new get_request("repos/#{owner}/#{repo}/hooks/#{id}").body end |
#list(owner:, repo:, **params) ⇒ Object
4 5 6 7 |
# File 'lib/gitea/resources/repo_hooks.rb', line 4 def list(owner:, repo:, **params) response = get_request("repos/#{owner}/#{repo}/hooks", params: params) Collection.from_response(response, type: Hook) end |
#test(owner:, repo:, id:) ⇒ Object
18 19 20 |
# File 'lib/gitea/resources/repo_hooks.rb', line 18 def test(owner:, repo:, id:) post_request("repos/#{owner}/#{repo}/hooks/#{id}/tests", body: {}) end |