Class: Lita::Handlers::GitHubWebHooks::Plugin

Inherits:
Handler
  • Object
show all
Defined in:
lib/lita/handlers/github_web_hooks/plugin.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_config(config) ⇒ Object



5
6
7
8
# File 'lib/lita/handlers/github_web_hooks/plugin.rb', line 5

def self.default_config(config)
  config.room_ids = []
  config.user_ids = []
end

.nameObject

Overrides the handler config key, from plugin to github_web_hooks.



11
12
13
# File 'lib/lita/handlers/github_web_hooks/plugin.rb', line 11

def self.name
  "GithubWebHooks"
end

Instance Method Details

#receive_hook(request, response) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/lita/handlers/github_web_hooks/plugin.rb', line 17

def receive_hook(request, response)
  if valid?(request)
    event_class = event_class_from_request(request)
    payload = extract_payload(request)
    event_class.new(robot, payload).call
  end

  response.status = 202
end