Module: GithubWebhook::Processor

Extended by:
ActiveSupport::Concern
Defined in:
lib/github_webhook/processor.rb

Defined Under Namespace

Classes: SignatureError, UnspecifiedWebhookSecretError, UnsupportedContentTypeError, UnsupportedGithubEventError

Constant Summary collapse

GITHUB_EVENTS =

To fetch list from developer.github.com/v3/activity/events/types run this little JS code in the console:

$("h3:contains('Webhook event name')").next('p').each((_, p) => console.log(p.innerText))
%w(
  check_run
  check_suite
  commit_comment
  create
  delete
  deployment
  deployment_status
  download
  follow
  fork
  fork_apply
  github_app_authorization
  gist
  gollum
  installation
  installation_repositories
  issue_comment
  issues
  label
  member
  membership
  milestone
  organization
  org_block
  page_build
  ping
  project_card
  project_column
  project
  public
  pull_request
  pull_request_review
  pull_request_review_comment
  push
  release
  repository
  repository_import
  repository_vulnerability_alert
  status
  team
  team_add
  watch
)

Instance Method Summary collapse

Instance Method Details

#createObject



62
63
64
65
66
67
68
69
# File 'lib/github_webhook/processor.rb', line 62

def create
  if self.respond_to?(event_method, true)
    self.send event_method, json_body
    head(:ok)
  else
    raise NoMethodError.new("GithubWebhooksController##{event_method} not implemented")
  end
end

#github_ping(payload) ⇒ Object



71
72
73
74
# File 'lib/github_webhook/processor.rb', line 71

def github_ping(payload)
  GithubWebhook.logger && GithubWebhook.logger.info("[GithubWebhook::Processor] Hook ping "\
    "received, hook_id: #{payload[:hook_id]}, #{payload[:zen]}")
end