11defmodule CodeCorps.GitHub.Event.IssueComment do
22 @ moduledoc ~S"""
33 In charge of handling a GitHub Webhook payload for the IssueComment event type
4+
45 [https://developer.github.com/v3/activity/events/types/#issuecommentevent](https://developer.github.com/v3/activity/events/types/#issuecommentevent)
56 """
67
@@ -12,8 +13,6 @@ defmodule CodeCorps.GitHub.Event.IssueComment do
1213 }
1314 alias GitHub.Sync
1415
15- @ type outcome :: Sync . outcome | { :error , :unexpected_payload }
16-
1716 @ doc ~S"""
1817 Handles the "IssueComment" GitHub webhook
1918
@@ -23,7 +22,8 @@ defmodule CodeCorps.GitHub.Event.IssueComment do
2322 - validate the action is properly supported
2423 - sync the comment using `CodeCorps.GitHub.Sync.Comment`
2524 """
26- @ spec handle ( map ) :: outcome
25+ @ impl CodeCorps.GitHub.Event.Handler
26+ @ spec handle ( map ) :: { :ok , any } | { :error , atom }
2727 def handle ( payload ) do
2828 with { :ok , :valid } <- validate_payload ( payload ) do
2929 Sync . issue_comment_event ( payload )
@@ -34,9 +34,10 @@ defmodule CodeCorps.GitHub.Event.IssueComment do
3434
3535 @ spec validate_payload ( map ) :: { :ok , :valid } | { :error , :unexpected_payload }
3636 defp validate_payload ( % { } = payload ) do
37- case payload |> Validator . valid? do
38- true -> { :ok , :valid }
39- false -> { :error , :unexpected_payload }
37+ if Validator . valid? ( payload ) do
38+ { :ok , :valid }
39+ else
40+ { :error , :unexpected_payload }
4041 end
4142 end
4243end
0 commit comments