Class: Tokite::HookEvent::Issues
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/issues.rb', line 4
def fields
{
event: "issues",
repo: hook_params[:repository][:full_name],
title: hook_params[:issue][:title],
body: hook_params[:issue][:body],
user: hook_params[:issue][:user][:login],
}
end
|
#notify? ⇒ Boolean
14
15
16
|
# File 'app/models/tokite/hook_event/issues.rb', line 14
def notify?
%w(opened).include?(hook_params[:action])
end
|
#slack_attachment ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'app/models/tokite/hook_event/issues.rb', line 22
def slack_attachment
{
title: "##{hook_params[:issue][:number]} #{hook_params[:issue][:title]}",
title_link: hook_params[:issue][:html_url],
fallback: "#{hook_params[:issue][:title]}\n#{hook_params[:issue][:body]}",
text: hook_params[:issue][:body],
color: "good",
}
end
|
#slack_text ⇒ Object
18
19
20
|
# File 'app/models/tokite/hook_event/issues.rb', line 18
def slack_text
"[#{hook_params[:repository][:full_name]}] Issue created by <#{hook_params[:issue][:user][:html_url]}|#{hook_params[:issue][:user][:login]}>"
end
|