Class: Tokite::HookEvent::IssueComment
- Inherits:
-
BaseEvent
- Object
- BaseEvent
- Tokite::HookEvent::IssueComment
show all
- Defined in:
- app/models/tokite/hook_event/issue_comment.rb
Instance Attribute Summary
Attributes inherited from BaseEvent
#hook_params
Instance Method Summary
collapse
Methods inherited from BaseEvent
#initialize, #slack_payload
Instance Method Details
#fields ⇒ Object
4
5
6
7
8
9
10
11
12
|
# File 'app/models/tokite/hook_event/issue_comment.rb', line 4
def fields
{
event: "issue_comment",
repo: hook_params[:repository][:full_name],
body: hook_params[:comment][:body],
user: hook_params[:comment][:user][:login],
label: hook_params[:issue][:labels].map { |label| label[:name] },
}
end
|
#notify? ⇒ Boolean
14
15
16
|
# File 'app/models/tokite/hook_event/issue_comment.rb', line 14
def notify?
%w(created).include?(hook_params[:action])
end
|
#slack_attachment ⇒ Object
22
23
24
25
26
27
28
|
# File 'app/models/tokite/hook_event/issue_comment.rb', line 22
def slack_attachment
{
fallback: hook_params[:comment][:body],
text: hook_params[:comment][:body],
color: "good",
}
end
|
#slack_text ⇒ Object
18
19
20
|
# File 'app/models/tokite/hook_event/issue_comment.rb', line 18
def slack_text
"[#{hook_params[:repository][:full_name]}] New comment by #{hook_params[:comment][:user][:login]} on issue <#{hook_params[:comment][:html_url]}|##{hook_params[:issue][:number]}: #{hook_params[:issue][:title]}>"
end
|