Skip to content

Instantly share code, notes, and snippets.

@richievos
Forked from avand/AppTweeter.rb
Created January 14, 2010 22:23
Show Gist options
  • Save richievos/277576 to your computer and use it in GitHub Desktop.
Save richievos/277576 to your computer and use it in GitHub Desktop.
AppTweeter = Struct.new(:status) do
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