Permalink
Browse files

Send email check

  • Loading branch information...
1 parent 6e343d1 commit e4f9f2b61b1bf2c377e36d45b74936227a2eda6a @alexch committed Jul 22, 2010
Showing with 32 additions and 31 deletions.
  1. +1 −0 config.ru
  2. +9 −0 lib/send.rb
  3. +22 −31 views/main.rb
View
@@ -1,2 +1,3 @@
+$:<<"."
require 'app'
run SentryApp
View
@@ -0,0 +1,9 @@
+class Send < Check
+
+ def run
+ to = param("to")
+ message = OutgoingMessage.new(:to => to, :subject => "hello from Sentry", :body => "hello, it's #{Time.now}")
+ message.deliver
+ OK
+ end
+end
View
@@ -1,5 +1,24 @@
class Main < Widget
needs :checks
+
+ def new_check(check_type, param_name, param_value)
+ div :class => "new" do
+ h3 check_type
+ form :action => "/check", :method => "post" do
+ input :type => "hidden", :name => "type", :value => check_type
+ table do
+ tr do
+ th param_name
+ td do
+ input :type => "text", :name => "params[#{param_name}]", :value => param_value
+ end
+ end
+ end
+ input :type => :submit, :value => "Check Now"
+ end
+ end
+ end
+
def content
head do
title "Sentry"
@@ -29,37 +48,9 @@ def content
STYLE
end
- div :class => "new" do
- h3 "Fetch"
- form :action => "/check", :method => "post" do
- input :type => "hidden", :name => "type", :value => "Fetch"
- table do
- tr do
- th "url"
- td do
- input :type => "text", :name => "params[url]", :value => "http://www.google.com"
- end
- end
- end
- input :type => :submit, :value => "Check Now"
- end
- end
-
- div :class => "new" do
- h3 "Countdown"
- form :action => "/check", :method => "post" do
- input :type => "hidden", :name => "type", :value => "Countdown"
- table do
- tr do
- th "sec"
- td do
- input :type => "text", :name => "params[sec]", :value => "10"
- end
- end
- end
- input :type => :submit, :value => "Check Now"
- end
- end
+ new_check("Fetch", "url", "http://www.google.com")
+ new_check("Countdown", "sec", "10")
+ new_check("Send", "to", "nobody@example.com")
div :class => "new" do
form :action => "/work", :method => "get" do

0 comments on commit e4f9f2b

Please sign in to comment.