Skip to content

Commit

Permalink
Merge commit '03ffa3'
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Nov 14, 2008
2 parents ed9335d + 03ffa3a commit 030a9fe
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/god.rb
Expand Up @@ -53,6 +53,10 @@

require 'god/contact'
require 'god/contacts/email'
begin
require 'god/contacts/twitterer'
rescue LoadError
end
begin
require 'god/contacts/jabber'
rescue LoadError
Expand Down
39 changes: 39 additions & 0 deletions lib/god/contacts/twitterer.rb
@@ -0,0 +1,39 @@
# For Twitter updates you need the 'twitter' gem
# (gem install twitter)
#
# Configure your watches like this:
#
# God::Contacts::Twitterer.settings = { :username => 'sender@example.com',
# :password => 'secret' }
# God.contact(:twitterer) do |c|
# c.name = 'Tester'
# c.group = 'developers'
# end

require 'rubygems'
require 'twitter'

module God
module Contacts
class Twitterer < Contact
class << self
attr_accessor :settings
end

def valid?
valid = true
end

def notify(message, time, priority, category, host)
begin
Twitter::Base.new(Twitterer.settings[:username],
Twitterer.settings[:password]).update(message)

self.info = "sent twitter update as #{Twitterer.settings[:username]}"
rescue => e
self.info = "failed to send twitter update from #{self.twitter_id}: #{e.message}"
end
end
end
end
end

0 comments on commit 030a9fe

Please sign in to comment.