twitter_alert¶ ↑
The problem that twitter_alert attempts to solve is the programmatic sending of DMs to all the followers of a given Twitter account. It is a simple gem that provides one Class and one Module. The class is TwitterAlert::Account and represents the Twitter account you want to make announcements from. The Module is TwitterAlert::Alert and should be mixed in to a class that you want to represent the messages themselves.
DISCLAIMER: Please, please, please don’t use this gem to spam people. If you do, I hope you get unfollowed or blocked. Seriously. Get permission. Make sure your followers know that by following your account they’re signing up to get DMs from a machine.
Installing¶ ↑
To install, simple:
sudo gem install twitter_alert
Note: This gem depends on Grackle for Twitter access.
Getting Started¶ ↑
The most basic case is pretty simple and would look something like this:
require 'twitter_alert' account = TwitterAlert::Account.new :user_name => 'benhamill', :password => 'thisisnotmyrealpassword' class Alert include TiwtterAlert::Alert end alert = Alert.new 'Very important message.', DateTime.now account.announce alert
In a real program, I’d expect that your Alert class would actually be somewhat more complicated and probably inherit from ActiveRecord or something. The way I intend to use this is to set up a cron job to pull messages out of the DB that are marked for a given day and send them.
Note on Patches/Pull Requests¶ ↑
This is the standard Jeweler procedure.
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright¶ ↑
Copyright © 2009 Ben Hamill. See LICENSE for details.