README.rdoc in streambot-0.5.4 vs README.rdoc in streambot-1.0.0.rc1
- old
+ new
@@ -5,11 +5,11 @@
== stable release
gem install streambot
-== beta release
+== development release
gem install streambot --pre
= Documentation
@@ -17,14 +17,14 @@
= Usage
require 'streambot'
- @params = { "oauth" => {"key" => "consumer key", "secret" => "consumer secret"},
- "http" => {"username" => "username", "password" => "password"} }
- @blacklist = ['mac_rt','apple_rt']
- bot = StreamBot::Tracker.new(@params, @blacklist, 'apple','ipad','iphone os 4','steve jobs')
+ @params = { 'auth' => { 'username' => 'your username', 'password' => 'your password' },
+ 'oauth' => { 'key' => 'your consumer key', 'secret' => 'your consumer secret' },
+ 'keywords' => ['nowplaying'] }
+ bot = StreamBot::Tracker.new(@params)
bot.start
= Configuration
Twitter has finally removed the http basic authentication for the REST API.
@@ -36,57 +36,57 @@
=== oauth
*key*:: The consumer key Twitter provides you
*secret*:: The consumer secret Twitter provides you
-=== http
+=== auth
*username*:: Your login username
*password*:: Your login password
-=== filters
-When a filter is matching on an status, then it won't be retweeted.
+=== keywords
+:: the list of keywords as an array
-*key*:: this should just hold an description of your filter
-*type*:: the type,
-*value*:: a string, thats the content that should be filtered
+=== filters_config
+:: the path to the filters.yml file
-----
-These types are actually supported:
-
-*USER*:: The users screenname/nickname *NOT* realname
-*SOURCE*:: The client which the user is using
-*LANGUAGE*:: The language that's set in users profile
-*TIMEZONE*:: The timezone that's set in users profile
-*CONTENT*:: A word the status text could include
-----
-
I wrote this stuff into my config.yml and load the params with
require 'yaml'
@params = YAML.load_file('config.yml')
-== Callbacks
+= Callbacks
-Since version 0.5.0 streambot has an simple callback mechanism.
+*on_error*:: this callback is fired when an error occures
-*before_start*:: is fired before the tracker is running
-*before_match*:: is fired before we start the filtering
-*match_filter*:: is fired when an filter has matched
-*before_retweet*:: is fired before retweeting
+= Filters
-=== Examples
-==== before_match
+You need to configure the *filters_config* in the params and set the path to the YAML file. At the moment this needs to be an YAML file, cause the tracker is reading this file, every time a new status comes in via the client. I decided to read it on each status, cause I don't wanted to restart the Tracker every time I made a change to the filters.
-Before filtering we just want to print the status id to the console
+For example we want to filter all tweets with the source "web", we need to define the following line in our *filters.yml*
- bot = StreamBot::Tracker.new(@params, nil,'nowplaying')
- bot.before_match do
- status = bot.instance_variable_get("@status")
- puts status.id
- end
- bot.start
+ "source": "web"
-That's just an example. You can do anything you want to do here.
+The Tracker checks if the field "source" of the incoming status *includes* OR *is equal* to "web". If you want to filter more than one source, you simply need to write it this way:
+
+ "source": ["web", "TweetDeck"]
+
+You can define all fields inside the status object. You want to filter tweets by me, so you need to define
+
+ "user/screen_name": "gr4y"
+
+You can even filter all tweets of users with an evil background color.
+
+ "user/profile_background_color": "666666"
+
+= Example
+
+ @params = YAML.load_file('config.yml')
+ @client = StreamBot::Tracker.new(@params)
+
+ @client.on_error do |msg, stacktrace|
+ puts msg
+ puts stacktrace
+ end
= Contribution
== Testing
All Tests should inherit from StreamBot::BaseTest