samedi 10 septembre 2016

Twitter Status feed in Rails using TwitterStream gem

I am using Twitterstream gem for creating a streaming application in rails. Followed the steps in the documentation. No error is coming but the feeds are not displaying in the views/index.html.erb page.

Here is the code: controllers/home_controller.rb

class HomeController < ApplicationController
def index
    @clients = TweetStream::Client.new
end

end

views/home/index.html/erb

<ul class='tweets'>
 <% @clients.sample.each do |status| %>
  <li><%= status.text %></li>
 <% end %>
</ul>

and my config/intializer/tweet.rb has

require 'tweetstream'
TweetStream.configure do |config|
 config.consumer_key       = "XXXXXXXXX"
 config.consumer_secret    = "XXXXXXXXX"
 config.oauth_token        = "XXXXXXXXX"
 config.oauth_token_secret = "XXXXXXXXX"
 config.auth_method        = :oauth
end

Aucun commentaire:

Enregistrer un commentaire