forked from alphagov/seal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.rb
28 lines (25 loc) · 789 Bytes
/
server.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require "sinatra"
require "./lib/seal"
require "./lib/github_fetcher"
require "./lib/message_builder"
require "./lib/slack_poster"
require "./lib/team_builder"
class SealApp < Sinatra::Base
get "/" do
"Hello Seal"
end
post "/bark/:team_name/:secret" do
if params[:secret] == ENV["SEAL_SECRET"]
team = TeamBuilder.build(env: ENV, team_name: params[:team_name])
Seal.new(team).bark
"Seal received message with #{params[:team_name]} team name"
end
end
post "/bark-quotes/:team_name/:secret" do
if params[:secret] == ENV["SEAL_SECRET"]
team = TeamBuilder.build(env: ENV, team_name: params[:team_name])
Seal.new(team).bark(mode: "quotes")
"Seal received message with #{params[:team_name]} team name for quotes"
end
end
end