Created
January 14, 2010 18:15
-
-
Save avand/277365 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppTweeter < Struct.new(:status) | |
class << self | |
def new_user(user) | |
update("#{user.name} just signed up!") | |
end | |
def update(status) | |
status = "[#{Rails.env}] #{status}" unless Rails.env.production? | |
Delayed::Job.enqueue AppTweeter.new(status) | |
end | |
end | |
def perform | |
raise "Twitter update failed" unless Kernel.system( | |
"curl -u twitter_handle:password -d \"status=#{URI.escape(status)}\" http://twitter.com/statuses/update.xml" | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment