-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ru
More file actions
46 lines (40 loc) · 793 Bytes
/
config.ru
File metadata and controls
46 lines (40 loc) · 793 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require 'bundler/setup'
require 'sinatra'
require File.expand_path(File.dirname(__FILE__) + '/gmail_leads_stats')
get "/stats" do
<<-EOS
<html>
<form method='post'>
<p>
<label>
Login:<br />
<input name='login' />
</label>
</p>
<p>
<label>
Password:<br />
<input name='password' type='password' />
</label>
</p>
<p>
<label>
Number of days:<br />
<input name='days' />
</label>
<br />
<small>Leave blank to process entire mailbox</small>
</p>
<p>
<input type='submit' value='Analyze!'/>
</p>
</form>
</html>
EOS
end
post "/stats" do
report = GmailAnalytics.run( params[:login], params[:password], params[:days] )
"<pre>" + report + "</pre>"
end
set :show_exceptions, true
run Sinatra::Application