I am using Tweetstream gem for Rails and keep getting stuck waiting for any update..
I basically do the example (with my oauth data etc. of course):
require 'Tweetstream'
TweetStream.configure do |config|
config.consumer_key = 'consumer_key'
config.consumer_secret = 'secret'
config.oauth_token = 'token'
config.oauth_token_secret = 'token_secret'
config.auth_method = :oauth
end
TweetStream::Client.new.sample do |status|
puts "SOMETHING HERE?"
puts "#{status.text}"
end
and nothing happens… the console is just waiting forever for anything to happen..
not even “SOMETHING HERE?” is getting printed..
I’ll take a wild guess and say you are putting this in an initializer? The gem doesn’t work this way. TweetStream is an event-based library and has a different runtime profile from that of a Rails app.
You will need to run TweetStream side by side with Rails as a daemon process collecting the tweets, storing them on a DB and Rails will access that same DB.
Use Rails Runner (http://guides.rubyonrails.org/command_line.html#rails-runner) to run your TweetStream daemon on the context of Rails, this should give you access to the models.