Class: Codebot::Formatters::Gitlab::WikiPageHook
Overview
Triggers on a Wiki Page Hook event
Instance Attribute Summary
#payload
Instance Method Summary
collapse
#abbreviate, #ary_to_sentence, #closed?, #extract, #format_branch, #format_dangerous, #format_event, #format_hash, #format_number, #format_repository, #format_url, #format_user, #gitlab_action, #gitlab_closed?, #gitlab_opened?, #gitlab_repository_url, #gitlab_url, #initialize, #opened?, #prettify, #repository_url, #sanitize, #shorten_url, #url
Instance Method Details
#action ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'lib/codebot/formatters/gitlab_wiki_page_hook.rb', line 37
def action
case wiki_action
when 'create' then 'created'
when 'delete' then 'deleted'
when 'update', nil then 'updated'
else wiki_action
end
end
|
21
22
23
|
# File 'lib/codebot/formatters/gitlab_wiki_page_hook.rb', line 21
def default_format
'[%<repository>s] %<sender>s %<action>s page \'%<title>s\''
end
|
8
9
10
|
# File 'lib/codebot/formatters/gitlab_wiki_page_hook.rb', line 8
def format
["#{summary}: #{format_url url}"]
end
|
#repository_name ⇒ Object
25
26
27
|
# File 'lib/codebot/formatters/gitlab_wiki_page_hook.rb', line 25
def repository_name
(:project, :path_with_namespace)
end
|
#sender_name ⇒ Object
29
30
31
|
# File 'lib/codebot/formatters/gitlab_wiki_page_hook.rb', line 29
def sender_name
(:user, :name)
end
|
#summary ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/codebot/formatters/gitlab_wiki_page_hook.rb', line 12
def summary
default_format % {
repository: format_repository(repository_name),
sender: format_user(sender_name),
action: action,
title: wiki_title
}
end
|
#summary_url ⇒ Object
33
34
35
|
# File 'lib/codebot/formatters/gitlab_wiki_page_hook.rb', line 33
def summary_url
(:object_attributes, :url)
end
|
#wiki_action ⇒ Object
46
47
48
|
# File 'lib/codebot/formatters/gitlab_wiki_page_hook.rb', line 46
def wiki_action
(:object_attributes, :action)
end
|
#wiki_title ⇒ Object
50
51
52
|
# File 'lib/codebot/formatters/gitlab_wiki_page_hook.rb', line 50
def wiki_title
(:object_attributes, :title)
end
|