Module: Codebot::Event

Defined in:
lib/codebot/event.rb

Overview

This module provides methods for processing webhook events.

Constant Summary collapse

VALID_SYMBOLS =

The currently supported events.

%i[
  commit_comment
  fork
  gollum
  issue_comment
  issues
  ping
  public
  pull_request
  pull_request_review_comment
  push
  watch

  gitlab_push_hook
  gitlab_tag_push_hook
  gitlab_job_hook
  gitlab_build_hook
  gitlab_pipeline_hook
  gitlab_issue_hook
  gitlab_note_hook
  gitlab_merge_request_hook
  gitlab_wiki_page_hook
].freeze

Class Method Summary collapse

Class Method Details

.symbolize(str) ⇒ Symbol?

Converts a webhook event to its corresponding symbol.

Parameters:

  • str (String)

    the event string

Returns:

  • (Symbol, nil)

    the symbol, or nil if the event is not supported



58
59
60
# File 'lib/codebot/event.rb', line 58

def self.symbolize(str)
  VALID_SYMBOLS.find { |sym| sym.to_s.casecmp(str).zero? }
end