Your SlideShare is downloading. ×
0
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Twitter on Rails
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Twitter on Rails

9,184

Published on

Learn how to build a Twitter application on Rails. Fast. Presented at RailsConf 2009 by Michael Bleigh.

Learn how to build a Twitter application on Rails. Fast. Presented at RailsConf 2009 by Michael Bleigh.

Published in: Technology, Sports
0 Comments
10 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
9,184
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
115
Comments
0
Likes
10
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Twitter on Rails Michael Bleigh, RailsConf 2009 Wednesday, May 6, 2009
  • 2. Wednesday, May 6, 2009
  • 3. Wednesday, May 6, 2009
  • 4. What’s the big f-ing deal? Wednesday, May 6, 2009
  • 5. MySpace Wednesday, May 6, 2009
  • 6. MySpace Wednesday, May 6, 2009
  • 7. Facebook Wednesday, May 6, 2009
  • 8. Facebook Wednesday, May 6, 2009
  • 9. How is different? Wednesday, May 6, 2009
  • 10. Audience. Ben Garney via Flickr Wednesday, May 6, 2009
  • 11. Public. three-B via Flickr Wednesday, May 6, 2009
  • 12. Search. Vitó via Flickr Wednesday, May 6, 2009
  • 13. API. benben via Flickr Wednesday, May 6, 2009
  • 14. In Code Wednesday, May 6, 2009
  • 15. Search API Wednesday, May 6, 2009
  • 16. require 'open-uri' require 'json' def search_twitter_for(query) query = CGI.escape(query) JSON.parse( open(quot;http://search.twitter.com/search.json?q=#{query}quot;).read )['results'] end search_twitter_for('RailsConf').collect{|s| s['text']} [ quot;Packing up for #railsconf. Swine flu here we come!quot;, quot;Putting new strings on some guitars for the #RailsConf music jam”, quot;Vegas, baby! All the @contrast boys laying into their first drinks...”, ... ] Wednesday, May 6, 2009
  • 17. OAuth Wednesday, May 6, 2009
  • 18. TCM Hitchhiker via Flickr Wednesday, May 6, 2009
  • 19. There’s a gem for that. ArtWerk via Flickr Wednesday, May 6, 2009
  • 20. The OAuth Shuffle • Consumer • Request Token • Authorization • Access! Wednesday, May 6, 2009
  • 21. Sign in with Twitter • Consumer • Request Token • Authorize (Just Once) • Access! Wednesday, May 6, 2009
  • 22. gem install oauth --version 0.3.2 require 'oauth' require 'json' # register your application at http://twitter.com/apps consumer = OAuth::Consumer.new( 'mykey','mysecret', :site => 'http://twitter.com/' ) request_token = consumer.get_request_token puts request_token.authorize_url # go and visit the authorize URL access_token = request_token.get_access_token me = JSON.parse(access_token.get('/account/verify_credentials.json').body) me['screen_name'] # => 'mbleigh' Wednesday, May 6, 2009
  • 23. Caveat OAuth • The Advisory (no callbacks) • Solution: One Dev App • Read/Write Inconsistency • Solution: Delete and Recreate Wednesday, May 6, 2009
  • 24. Rails Wednesday, May 6, 2009
  • 25. TwitterAuth github.com/mbleigh/twitter-auth Wednesday, May 6, 2009
  • 26. TwitterAuth makes Rails Twitter apps stupid simple. Wednesday, May 6, 2009
  • 27. Just enough magic. Steffe via Flickr Wednesday, May 6, 2009
  • 28. Livecoding! Wednesday, May 6, 2009
  • 29. Twisteners Who actually listens? Wednesday, May 6, 2009
  • 30. Application Goals • Log in via Twitter • See a list of top mentioners • Tweet the top three “twisteners” Wednesday, May 6, 2009
  • 31. Step 1: Credentials Wednesday, May 6, 2009
  • 32. twitter.com/apps Wednesday, May 6, 2009
  • 33. Step 2: Template Wednesday, May 6, 2009
  • 34. Type the Magic Words rails -m http://bit.ly/twitter-rails yourapp Wednesday, May 6, 2009
  • 35. TwitterAuth • Engines-based login • logged_in? and current_user • user.twitter.get(‘/api/path’) Wednesday, May 6, 2009
  • 36. Twitter Template • helpers for common twitter needs • instant gratification Wednesday, May 6, 2009
  • 37. Step 3: Aggregate Wednesday, May 6, 2009
  • 38. Step 4: Share Wednesday, May 6, 2009
  • 39. twisteners.heroku.com github.com/mbleigh/twisteners Wednesday, May 6, 2009
  • 40. Follow me: @mbleigh Wednesday, May 6, 2009

×