Skip to content

Instantly share code, notes, and snippets.

@avand
Created January 14, 2010 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save avand/277365 to your computer and use it in GitHub Desktop.
Save avand/277365 to your computer and use it in GitHub Desktop.
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