lib/rackamole/alert/twitt.rb in rackamole-0.2.5 vs lib/rackamole/alert/twitt.rb in rackamole-0.2.6
- old
+ new
@@ -4,12 +4,12 @@
# Leverage twitter as a notification client. You can setup a private twitter account
# and have your moled app twitt exception/perf alerts...
class Twitt
# Twitt an alert
- def self.deliver_alert( username, password, attrs )
- @twitt ||= Twitt.new( username, password )
+ def self.deliver_alert( logger, username, password, attrs )
+ @twitt ||= Twitt.new( logger, username, password )
@twitt.send_alert( attrs )
end
# This class is used to send out moled twitter notification. This feature is enabled
# by setting both :twitter_auth and twitt_on options on the Rack::Mole. When a moled
@@ -25,14 +25,15 @@
# regardless.
#
# === Params:
# username :: The name on the twitter account
# password :: The password of your twitter account
- def initialize( username, password )
+ def initialize( logger, username, password )
raise "You must specify your twitter account credentials" unless username or password
@username = username
@password = password
+ @logger = logger
end
# Send out a twitt notification based of the watched features. A short message will be blasted to your twitter
# account based on information reported by the mole. The twitt will be automatically truncated
# to 140 chars.
@@ -60,10 +61,10 @@
end
# =========================================================================
private
- attr_reader :username, :password #:nodoc:
+ attr_reader :logger, :username, :password #:nodoc:
# Fetch twitter connection...
def twitt
@twitt ||= ::Twitter::Client.new( :login => username, :password => password )
end
\ No newline at end of file