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_WHITELIST =

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

var events = "ping";
$('h3').each(function(i, item) {
  if ($(item).text().match(/webhook event name/i)) {
    events = events + ' ' + $(item).next('p').find('code').html();
  }
});
console.log(events);
%w(
  commit_comment
  create
  delete
  deployment
  deployment_status
  download
  follow
  fork
  fork_apply
  gist
  gollum
  installation
  installation_repositories
  integration_installation
  integration_installation_repositories
  issues
  issue_comment
  label
  marketplace_purchase
  member
  membership
  milestone
  organization
  org_block
  page_build
  ping
  project
  project_card
  project_column
  public
  pull_request
  pull_request_review
  pull_request_review_comment
  push
  release
  repository
  status
  team
  team_add
  watch
)

Instance Method Summary collapse

Instance Method Details

#createObject



66
67
68
69
70
71
72
73
# File 'lib/github_webhook/processor.rb', line 66

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

#github_ping(payload) ⇒ Object



75
76
77
# File 'lib/github_webhook/processor.rb', line 75

def github_ping(payload)
  puts "[GithubWebhook::Processor] Hook ping received, hook_id: #{payload[:hook_id]}, #{payload[:zen]}"
end