class Prpr::Event::Event

Public Class Methods

parse(payload, event:) click to toggle source
# File lib/prpr/event/event.rb, line 11
def parse(payload, event:)
  case event
  when 'pull_request'
    PullRequest.new(JSON.parse(payload))
  when 'push'
    Push.new(JSON.parse(payload))
  when 'issue_comment'
    IssueComment.new(JSON.parse(payload))
  when 'commit_comment'
    CommitComment.new(JSON.parse(payload))
  when 'pull_request_review'
    PullRequestReview.new(JSON.parse(payload))
  when 'pull_request_review_comment'
    PullRequestReviewComment.new(JSON.parse(payload))
  else
    fail UnknownEvent, event
  end
end