Sha256: e812c604f5ff38ebc6490bdfda52f847338df8a33901de2d41a10c02b2b5bad2

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 KB

Contents

require 'forwardable'
require 'rubygems'

gem 'oauth', '0.3.2'
require 'oauth'

gem 'mash', '0.0.3'
require 'mash'

gem 'httparty', '0.4.3'
require 'httparty'

module Twitter
  class TwitterError < StandardError
    attr_reader :data
    
    def initialize(data)
      @data = data
      super
    end
  end
  
  class RateLimitExceeded < TwitterError; end
  class Unauthorized      < TwitterError; end
  class General           < TwitterError; end
  
  class Unavailable   < StandardError; end
  class InformTwitter < StandardError; end
  class NotFound      < StandardError; end
  
  
  def self.firehose
    response = HTTParty.get('http://twitter.com/statuses/public_timeline.json', :format => :json)
    response.map { |tweet| Mash.new(tweet) }
  end
  
  def self.user(id)
    response = HTTParty.get("http://twitter.com/users/show/#{id}.json", :format => :json)
    Mash.new(response)
  end
  
  def self.status(id)
    response = HTTParty.get("http://twitter.com/statuses/show/#{id}.json", :format => :json)
    Mash.new(response)
  end
  
  def self.friend_ids(id)
    HTTParty.get("http://twitter.com/friends/ids/#{id}.json", :format => :json)
  end
  
  def self.follower_ids(id)
    HTTParty.get("http://twitter.com/followers/ids/#{id}.json", :format => :json)
  end
end

directory = File.dirname(__FILE__)
$:.unshift(directory) unless $:.include?(directory)

require 'twitter/oauth'
require 'twitter/httpauth'
require 'twitter/request'
require 'twitter/base'
require 'twitter/search'

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
jnunemaker-twitter-0.6.7 lib/twitter.rb
jnunemaker-twitter-0.6.8 lib/twitter.rb
ssoroka-twitter-0.6.7 lib/twitter.rb