mbleigh / twitterdispatch

A simple Twitter API wrapper that gets out of your way.

This URL has Read+Write access

mbleigh (author)
Thu Apr 09 12:57:17 -0700 2009
commit  3975a4071b4b872f260fe5ff1a4fc51a8cada403
tree    db3996167d1a2381e38e71c2917e2b75ba4b6748
parent  796971e18a8e91b4a4530a38e83f07373c12459f
twitterdispatch / README.rdoc
100644 38 lines (24 sloc) 2.052 kb

TwitterDispatch

TwitterDispatch is an unassuming API wrapper for Twitter based on the dispatcher from TwitterAuth. Rather than create a complex object mapping system around the simple REST API Twitter provides, TwitterDispatch simply gives you the tools to make calls directly to the API URLs and parse the results (or not).

TwitterDispatch supports both OAuth and HTTP Basic authentication strategies.

Usage

To use TwitterDispatch you will need different things depending on the strategy you are using:

  • OAuth - You will need to have already registered your application with Twitter (have a consumer key and secret) as well as performed the entire OAuth authentication process (have an access key and secret). If you don’t know much about OAuth and are building a Rails application, I would suggest using TwitterAuth instead.
  • HTTP Basic - You will need to have the screen name and password for the authenticating user.

Usage of TwitterDispatch is straightforward. Here are some basic examples to get you going.

    # OAuth Example
    dispatcher = TwitterDispatch.new(:oauth, 'myconsumerkey', 'myconsumersecret', 'myaccesskey', 'myaccesssecret')
    dispatcher.get('/account/verify_credentials') # => {'screen_name' => ...}
    dispatcher.post('/statuses/update', :status => 'Update my status.') # => {'text' => 'Update my status.' ... }

    # HTTP Basic Example
    dispatcher = TwitterDispatch.new(:basic, 'screenname', 'password')
    dispatcher.get('/statuses/friends_timeline') # => [{'text' => ...}]

    # No Auth Example
    dispatcher = TwitterDispatch.new
    dispatcher.get('/statuses/public_timeline') # => [{'text' => ...}]

    # Search Example
    dispatcher = TwitterDispatch.new
    dispatcher.search('query text') # => [{'text' => ...}]

TwitterDispatch is not meant to be complex or assuming, it literally just does the bare minimum to provide you with a simple and direct access to the Twitter API in Ruby.

Copyright

Copyright © 2009 Michael Bleigh and Intridea, Inc. See LICENSE for details.