SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
Twitter on Rails
                         Michael Bleigh, RailsConf 2009




Wednesday, May 6, 2009
Wednesday, May 6, 2009
Wednesday, May 6, 2009
What’s the big
                          f-ing deal?

Wednesday, May 6, 2009
MySpace


Wednesday, May 6, 2009
MySpace


Wednesday, May 6, 2009
Facebook


Wednesday, May 6, 2009
Facebook


Wednesday, May 6, 2009
How is
                           different?

Wednesday, May 6, 2009
Audience.
                                     Ben Garney via Flickr
Wednesday, May 6, 2009
Public.


                         three-B via Flickr
Wednesday, May 6, 2009
Search.


                               Vitó via Flickr
Wednesday, May 6, 2009
API.




                                benben via Flickr
Wednesday, May 6, 2009
In Code


Wednesday, May 6, 2009
Search API


Wednesday, May 6, 2009
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
OAuth
Wednesday, May 6, 2009
TCM Hitchhiker via Flickr
Wednesday, May 6, 2009
There’s a gem
                           for that.

                                     ArtWerk via Flickr
Wednesday, May 6, 2009
The OAuth Shuffle

           •      Consumer
           • Request Token
           • Authorization
           • Access!

Wednesday, May 6, 2009
Sign in with Twitter

           •      Consumer
           • Request Token
           • Authorize (Just Once)
           • Access!

Wednesday, May 6, 2009
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
Caveat OAuth

           •      The Advisory (no callbacks)
                 • Solution: One Dev App
           •      Read/Write Inconsistency
                 • Solution: Delete and Recreate

Wednesday, May 6, 2009
Rails

Wednesday, May 6, 2009
TwitterAuth
                         github.com/mbleigh/twitter-auth




Wednesday, May 6, 2009
TwitterAuth makes
                     Rails Twitter apps
                       stupid simple.


Wednesday, May 6, 2009
Just enough magic.
                                              Steffe via Flickr
Wednesday, May 6, 2009
Livecoding!


Wednesday, May 6, 2009
Twisteners
                         Who actually listens?




Wednesday, May 6, 2009
Application Goals

           • Log in via Twitter
           • See a list of top mentioners
           • Tweet the top three “twisteners”

Wednesday, May 6, 2009
Step 1:
                         Credentials

Wednesday, May 6, 2009
twitter.com/apps


Wednesday, May 6, 2009
Step 2:
                         Template

Wednesday, May 6, 2009
Type the Magic Words
                rails -m http://bit.ly/twitter-rails yourapp




Wednesday, May 6, 2009
TwitterAuth

                   • Engines-based login
                   • logged_in? and current_user
                   • user.twitter.get(‘/api/path’)

Wednesday, May 6, 2009
Twitter Template


                   • helpers for common twitter needs
                   • instant gratification


Wednesday, May 6, 2009
Step 3:
                         Aggregate

Wednesday, May 6, 2009
Step 4:
                         Share

Wednesday, May 6, 2009
twisteners.heroku.com
                         github.com/mbleigh/twisteners




Wednesday, May 6, 2009
Follow me:

                         @mbleigh

Wednesday, May 6, 2009

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (16)

Ai Weiwei
Ai WeiweiAi Weiwei
Ai Weiwei
 
Web2.0 - wat is dat beest?
Web2.0 - wat is dat beest?Web2.0 - wat is dat beest?
Web2.0 - wat is dat beest?
 
Passwords, Attacks, and Security oh My!
Passwords, Attacks, and Security oh My!Passwords, Attacks, and Security oh My!
Passwords, Attacks, and Security oh My!
 
Start It Up For Free
Start It Up For FreeStart It Up For Free
Start It Up For Free
 
WordPress Foundation
WordPress FoundationWordPress Foundation
WordPress Foundation
 
世界標準パブリッシングプラットホーム WordPress
世界標準パブリッシングプラットホーム WordPress世界標準パブリッシングプラットホーム WordPress
世界標準パブリッシングプラットホーム WordPress
 
LaughTrack
LaughTrackLaughTrack
LaughTrack
 
Storytelling & Social Media: Video Creation
Storytelling & Social Media: Video Creation Storytelling & Social Media: Video Creation
Storytelling & Social Media: Video Creation
 
Cua09 Mikeseyfang
Cua09 MikeseyfangCua09 Mikeseyfang
Cua09 Mikeseyfang
 
2012 mLearning DevCon – Mike Rustici
2012 mLearning DevCon – Mike Rustici2012 mLearning DevCon – Mike Rustici
2012 mLearning DevCon – Mike Rustici
 
Social Bookmarking for Educators
Social Bookmarking for EducatorsSocial Bookmarking for Educators
Social Bookmarking for Educators
 
Online Film Distribution
Online Film DistributionOnline Film Distribution
Online Film Distribution
 
Developing with the web
Developing with the webDeveloping with the web
Developing with the web
 
Being There In The Unevenly Distributed Future
Being There In The Unevenly Distributed FutureBeing There In The Unevenly Distributed Future
Being There In The Unevenly Distributed Future
 
Get The Top Tips For Successful Business In New Year
Get The Top Tips For Successful Business In New YearGet The Top Tips For Successful Business In New Year
Get The Top Tips For Successful Business In New Year
 
5.5 User Testing Approaches: The Environmental Defense Fund / Forum One Web E...
5.5 User Testing Approaches: The Environmental Defense Fund / Forum One Web E...5.5 User Testing Approaches: The Environmental Defense Fund / Forum One Web E...
5.5 User Testing Approaches: The Environmental Defense Fund / Forum One Web E...
 

Ähnlich wie Twitter on Rails

Flash on Tap slides
Flash on Tap slidesFlash on Tap slides
Flash on Tap slides
jkosoy
 
Presentation for UNICEF comms workshop - Panama, May 2009
Presentation for UNICEF comms workshop - Panama, May 2009Presentation for UNICEF comms workshop - Panama, May 2009
Presentation for UNICEF comms workshop - Panama, May 2009
georgiap
 
Personal branding, social media and pretty pictures
Personal branding, social media and pretty picturesPersonal branding, social media and pretty pictures
Personal branding, social media and pretty pictures
Jure Cuhalev
 

Ähnlich wie Twitter on Rails (20)

ERECOMPI
ERECOMPIERECOMPI
ERECOMPI
 
Rails3: Stepping off of the golden path
Rails3: Stepping off of the golden pathRails3: Stepping off of the golden path
Rails3: Stepping off of the golden path
 
Session 7
Session 7 Session 7
Session 7
 
Libraries + Semantic Web = ?
Libraries + Semantic Web = ?Libraries + Semantic Web = ?
Libraries + Semantic Web = ?
 
Oxente on Rails 2009
Oxente on Rails 2009Oxente on Rails 2009
Oxente on Rails 2009
 
10 web 2.0 tools marketers can use today
10 web 2.0 tools marketers can use today10 web 2.0 tools marketers can use today
10 web 2.0 tools marketers can use today
 
An Open Civic Engagement Platform: Plone, Salesforce and Friends
An Open Civic Engagement Platform: Plone, Salesforce and FriendsAn Open Civic Engagement Platform: Plone, Salesforce and Friends
An Open Civic Engagement Platform: Plone, Salesforce and Friends
 
It's the Little Things
It's the Little ThingsIt's the Little Things
It's the Little Things
 
Flash on Tap slides
Flash on Tap slidesFlash on Tap slides
Flash on Tap slides
 
Information Commons and New Norms for Science
Information Commons and New Norms for ScienceInformation Commons and New Norms for Science
Information Commons and New Norms for Science
 
The ABC of User Testing
The ABC of User TestingThe ABC of User Testing
The ABC of User Testing
 
Why Twitter?
Why Twitter?Why Twitter?
Why Twitter?
 
Depot Best Practices
Depot Best PracticesDepot Best Practices
Depot Best Practices
 
Presentation for UNICEF comms workshop - Panama, May 2009
Presentation for UNICEF comms workshop - Panama, May 2009Presentation for UNICEF comms workshop - Panama, May 2009
Presentation for UNICEF comms workshop - Panama, May 2009
 
Personal branding, social media and pretty pictures
Personal branding, social media and pretty picturesPersonal branding, social media and pretty pictures
Personal branding, social media and pretty pictures
 
Move Over Text: Video Documentation Meets DITA
Move Over Text: Video Documentation Meets DITAMove Over Text: Video Documentation Meets DITA
Move Over Text: Video Documentation Meets DITA
 
Why I Hate Drupal
Why I Hate DrupalWhy I Hate Drupal
Why I Hate Drupal
 
理解开放教育的意义 突破教育资源的限定
理解开放教育的意义 突破教育资源的限定理解开放教育的意义 突破教育资源的限定
理解开放教育的意义 突破教育资源的限定
 
Collaboration: Top Ten Trends
Collaboration: Top Ten TrendsCollaboration: Top Ten Trends
Collaboration: Top Ten Trends
 
DrupalCon DC: Busines Analytics with Views
DrupalCon DC: Busines Analytics with ViewsDrupalCon DC: Busines Analytics with Views
DrupalCon DC: Busines Analytics with Views
 

Mehr von Michael Bleigh

Mehr von Michael Bleigh (10)

OmniAuth: From the Ground Up (RailsConf 2011)
OmniAuth: From the Ground Up (RailsConf 2011)OmniAuth: From the Ground Up (RailsConf 2011)
OmniAuth: From the Ground Up (RailsConf 2011)
 
OmniAuth: From the Ground Up
OmniAuth: From the Ground UpOmniAuth: From the Ground Up
OmniAuth: From the Ground Up
 
The Grapes of Rapid (RubyConf 2010)
The Grapes of Rapid (RubyConf 2010)The Grapes of Rapid (RubyConf 2010)
The Grapes of Rapid (RubyConf 2010)
 
Upgrading to Rails 3
Upgrading to Rails 3Upgrading to Rails 3
Upgrading to Rails 3
 
Deciphering the Interoperable Web
Deciphering the Interoperable WebDeciphering the Interoperable Web
Deciphering the Interoperable Web
 
The Present Future of OAuth
The Present Future of OAuthThe Present Future of OAuth
The Present Future of OAuth
 
Node.js and Ruby
Node.js and RubyNode.js and Ruby
Node.js and Ruby
 
Persistence Smoothie: Blending SQL and NoSQL (RubyNation Edition)
Persistence  Smoothie: Blending SQL and NoSQL (RubyNation Edition)Persistence  Smoothie: Blending SQL and NoSQL (RubyNation Edition)
Persistence Smoothie: Blending SQL and NoSQL (RubyNation Edition)
 
Persistence Smoothie
Persistence SmoothiePersistence Smoothie
Persistence Smoothie
 
Hacking the Mid-End (Great Lakes Ruby Bash Edition)
Hacking the Mid-End (Great Lakes Ruby Bash Edition)Hacking the Mid-End (Great Lakes Ruby Bash Edition)
Hacking the Mid-End (Great Lakes Ruby Bash Edition)
 

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Twitter on Rails