Class: Gitea::RepoHooksResource
Instance Attribute Summary
Attributes inherited from Resource
#client
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
#initialize
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
|
#update(owner:, repo:, id:, **args) ⇒ Object
22
23
24
|
# File 'lib/gitea/resources/repo_hooks.rb', line 22
def update(owner:, repo:, id:, **args)
Hook.new patch_request("repos/#{owner}/#{repo}/hooks/#{id}", body: args).body
end
|