Class: Tokite::HookEvent::IssueComment

Inherits:
BaseEvent
  • Object
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

Constructor Details

This class inherits a constructor from Tokite::HookEvent::BaseEvent

Instance Method Details

#fieldsObject



4
5
6
7
8
9
10
11
# 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],
  }
end

#notify?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'app/models/tokite/hook_event/issue_comment.rb', line 13

def notify?
  %w(created).include?(hook_params[:action])
end

#slack_attachmentObject



21
22
23
24
25
26
27
# File 'app/models/tokite/hook_event/issue_comment.rb', line 21

def slack_attachment
  {
    fallback: hook_params[:comment][:body],
    text: hook_params[:comment][:body],
    color: "good",
  }
end

#slack_textObject



17
18
19
# File 'app/models/tokite/hook_event/issue_comment.rb', line 17

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