Class: Vx::ServiceConnector::GitlabV5::Hooks
- Inherits:
-
Struct
- Object
- Struct
- Vx::ServiceConnector::GitlabV5::Hooks
show all
- Defined in:
- lib/vx/service_connector/gitlab_v5/hooks.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#repo ⇒ Object
Returns the value of attribute repo
4
5
6
|
# File 'lib/vx/service_connector/gitlab_v5/hooks.rb', line 4
def repo
@repo
end
|
#session ⇒ Object
Returns the value of attribute session
4
5
6
|
# File 'lib/vx/service_connector/gitlab_v5/hooks.rb', line 4
def session
@session
end
|
Instance Method Details
#all ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/vx/service_connector/gitlab_v5/hooks.rb', line 6
def all
begin
session.get hooks_url
rescue RequestError
[]
end
end
|
#create(url, token) ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/vx/service_connector/gitlab_v5/hooks.rb', line 14
def create(url, token)
session.post(
hooks_url,
url: url,
push_events: true,
merge_requests_events: true
)
end
|
#destroy(url_mask) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/vx/service_connector/gitlab_v5/hooks.rb', line 23
def destroy(url_mask)
all.select do |hook|
hook.url =~ /#{Regexp.escape url_mask}/
end.map do |hook|
session.delete hook_url(hook.id)
end
end
|