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(ping commit_comment create delete deployment deployment_status download follow fork fork_apply gist gollum issue_comment issues label member membership milestone organization org_block page_build project_card project_column project 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



25
26
27
28
29
30
31
32
# File 'lib/github_webhook/processor.rb', line 25

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



34
35
36
# File 'lib/github_webhook/processor.rb', line 34

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