REST noob here:
I’m using the code from ryan bates rails cast #241
http://railscasts.com/episodes/241-simple-omniauth
I can authenticate with my user just fine….
Now I want to display the last tweet I made on the views/articles/index.html.erb page….
I want to just want to display the data from this REST api thing…”https://dev.twitter.com/docs/api/1.1/get/statuses/home_timeline”
How do I change this code in the most simplest way?
<% title "Articles" %>
<div id="articles">
<!-- TODO grab my tweets with GET Statuses/home_timeline -->
<% for article in @articles %>
<h2>
<%= link_to article.name, article %>
<span class="comments">(<%= pluralize(article.comments.size, 'comment') %>)</span>
</h2>
<div class="created_at">on <%= article.created_at.strftime('%b %d, %Y') %></div>
<div class="content"><%= simple_format(article.content) %></div>
<% end %>
</div>
<p><%= link_to "New Article", new_article_path %></p>
Thank you for help.
You should take a loot at twitter gem: http://sferik.github.com/twitter/
You can grab a user’s timeline like:
timeline = Twitter.user_timeline( twitter_username )