Twitter4j4r
A thin, woefully inadequate wrapper around twitter4j forked from tobias. It will only work under JRuby.
Installation
Add this line to your application's Gemfile:
gem 'incomplete-twitter4j4r'
And then execute:
$ bundle
Or install it yourself as:
$ gem install incomplete-twitter4j4r
Usage
Create a configuration object and a client:
config = Twitter4j4r::Config.new
config.consumer_key = 'ABC456'
config.consumer_secret = 'ABC456'
config.access_token = 'ABC456'
config.access_token_secret = 'ABC456'
client = Twitter4j4r::Client.new config
To access the sample stream:
stream = client.add_stream :insert_stream_name_here
stream.sample do |tweet|
puts "#{tweet.user.screen_name} says \"#{tweet.text}\""
end
Tracking a keyword:
stream = client.add_stream :insert_stream_name_here
stream.track('bieber') do |tweet|
puts "#{tweet.user.screen_name} says #{tweet.text}"
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Thanks to Tobias Crawley for the original codebase.