Class: Gitea::OrgHooksResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/gitea/resources/org_hooks.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Gitea::Resource

Instance Method Details

#create(org:, url:, type:, **args) ⇒ Object



13
14
15
16
# File 'lib/gitea/resources/org_hooks.rb', line 13

def create(org:, url:, type:, **args)
  data = {config: {content_type: "json", url: url}, type: type}
  Hook.new post_request("orgs/#{org}/hooks", body: args.merge(data)).body
end

#delete(org:, id:) ⇒ Object



22
23
24
# File 'lib/gitea/resources/org_hooks.rb', line 22

def delete(org:, id:)
  delete_request("orgs/#{org}/hooks/#{id}")
end

#get(org:, id:) ⇒ Object



9
10
11
# File 'lib/gitea/resources/org_hooks.rb', line 9

def get(org:, id:)
  Hook.new get_request("orgs/#{org}/hooks/#{id}").body
end

#list(org:, **params) ⇒ Object



4
5
6
7
# File 'lib/gitea/resources/org_hooks.rb', line 4

def list(org:, **params)
  response = get_request("orgs/#{org}/hooks", params: params)
  Collection.from_response(response, type: Hook)
end

#update(org:, id:, **args) ⇒ Object



18
19
20
# File 'lib/gitea/resources/org_hooks.rb', line 18

def update(org:, id:, **args)
  Hook.new patch_request("orgs/#{org}/hooks/#{id}", body: args).body
end