Class: Codebot::Formatters::Gitlab::IssueHook
Overview
This class formats issues events.
Instance Attribute Summary
#payload
Instance Method Summary
collapse
#abbreviate, #action, #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_name, #repository_url, #sanitize, #sender_name, #shorten_url, #url
Instance Method Details
38
39
40
41
|
# File 'lib/codebot/formatters/gitlab_issue_hook.rb', line 38
def default_format
'[%<repository>s] %<sender>s %<action>s issue #%<number>s:' \
' %<title>s: %<url>s'
end
|
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/codebot/formatters/gitlab_issue_hook.rb', line 43
def format
[default_format % {
repository: format_repository(repo_name),
sender: format_user(user_name),
action: format_issue_action,
number: (:object_attributes, :iid),
title: (:object_attributes, :title),
url: issue_url
}]
end
|
12
13
14
15
16
17
18
19
20
|
# File 'lib/codebot/formatters/gitlab_issue_hook.rb', line 12
def format_issue_action
case issue_action
when 'open' then 'opened'
when 'close' then 'closed'
when 'reopen' then 'reopened'
when 'update', nil then 'updated'
else issue_action
end
end
|
#issue_action ⇒ Object
8
9
10
|
# File 'lib/codebot/formatters/gitlab_issue_hook.rb', line 8
def issue_action
(:object_attributes, :action)
end
|
#issue_url ⇒ Object
30
31
32
|
# File 'lib/codebot/formatters/gitlab_issue_hook.rb', line 30
def issue_url
shorten_url (:object_attributes, :url)
end
|
#repo_name ⇒ Object
26
27
28
|
# File 'lib/codebot/formatters/gitlab_issue_hook.rb', line 26
def repo_name
(:project, :path_with_namespace)
end
|
#repo_url ⇒ Object
22
23
24
|
# File 'lib/codebot/formatters/gitlab_issue_hook.rb', line 22
def repo_url
(:project, :web_url)
end
|
#user_name ⇒ Object
34
35
36
|
# File 'lib/codebot/formatters/gitlab_issue_hook.rb', line 34
def user_name
(:user, :name)
end
|