Sha256: afa2ae327342e19d61217a3d24fa9ebc860b6352b6abdcf1c3b8aa4f44951156

Contents?: true

Size: 1004 Bytes

Versions: 47

Compression:

Stored size: 1004 Bytes

Contents

# For Twitter updates you need the 'twitter' gem
#   (gem install twitter)
#
# Configure your watches like this:
#
#   God::Contacts::Twitter.settings = { :username => 'sender@example.com',
#                                       :password  => 'secret' }
#   God.contact(:twitter) do |c|
#     c.name      = 'Tester'
#     c.group     = 'developers'
#   end

require 'rubygems'
require 'twitter'

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

      def valid?
        valid = true
      end

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

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

Version data entries

47 entries across 47 versions & 15 rubygems

Version Path
dguettler-god-0.7.13.2 lib/god/contacts/twitter.rb
dguettler-god-0.7.13.3 lib/god/contacts/twitter.rb
dunedain289-god-0.7.12.1 lib/god/contacts/twitter.rb
eric-god-0.7.10 lib/god/contacts/twitter.rb
eric-god-0.7.11 lib/god/contacts/twitter.rb
eric-god-0.7.12 lib/god/contacts/twitter.rb
eric-god-0.7.14 lib/god/contacts/twitter.rb
fotonauts-god-0.7.10 lib/god/contacts/twitter.rb
fotonauts-god-0.7.12 lib/god/contacts/twitter.rb
gordoncww-god-0.7.11.1 lib/god/contacts/twitter.rb
jreynolds-god-0.7.13 lib/god/contacts/twitter.rb
mathieuravaux-god-0.7.11 lib/god/contacts/twitter.rb
mojombo-god-0.7.10 lib/god/contacts/twitter.rb
mojombo-god-0.7.11 lib/god/contacts/twitter.rb
mojombo-god-0.7.12 lib/god/contacts/twitter.rb
mojombo-god-0.7.13 lib/god/contacts/twitter.rb
mojombo-god-0.7.14 lib/god/contacts/twitter.rb
mojombo-god-0.7.15 lib/god/contacts/twitter.rb
mojombo-god-0.7.16 lib/god/contacts/twitter.rb
mojombo-god-0.7.20 lib/god/contacts/twitter.rb