Class: Tokite::HookEvent::PullRequestReviewComment

Inherits:
BaseEvent
  • Object
show all
Defined in:
app/models/tokite/hook_event/pull_request_review_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/pull_request_review_comment.rb', line 4

def fields
  {
    event: "pull_request_review_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/pull_request_review_comment.rb', line 13

def notify?
  hook_params[:action] == "created"
end

#slack_attachmentObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/models/tokite/hook_event/pull_request_review_comment.rb', line 21

def slack_attachment
  user = hook_params[:comment][:user][:login]
  line = hook_params[:comment][:position]
  path = hook_params[:comment][:path]
  footer_url = hook_params[:comment][:html_url]
  footer_text = "Comment by #{user} on line #{line} of #{path}"
  {
    fallback: "#{hook_params[:comment][:body]}\n#{footer_text}",
    text: hook_params[:comment][:body],
    footer: "<#{footer_url}|#{footer_text}>"
  }
end

#slack_textObject



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

def slack_text
  nil
end