Sha256: 77b9536da7839cee461ebe416e4d81832da73543621b1f1bdb762d9b4ecd7e49

Contents?: true

Size: 1.61 KB

Versions: 4

Compression:

Stored size: 1.61 KB

Contents

require 'forwardable'
require 'rubygems'

gem 'oauth', '0.3.4'
require 'oauth'

gem 'peterpunk-mhash', '0.0.8'
require 'mhash'

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| Mhash.new(tweet) }
  end
  
  def self.user(id)
    response = HTTParty.get("http://twitter.com/users/show/#{id}.json", :format => :json)
    Mhash.new(response)
  end
  
  def self.status(id)
    response = HTTParty.get("http://twitter.com/statuses/show/#{id}.json", :format => :json)
    Mhash.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.expand_path(File.dirname(__FILE__))

require File.join(directory, 'twitter', 'oauth')
require File.join(directory, 'twitter', 'httpauth')
require File.join(directory, 'twitter', 'request')
require File.join(directory, 'twitter', 'base')
require File.join(directory, 'twitter', 'search')
require File.join(directory, 'twitter', 'trends')

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
deedubs-twitter-0.7.0 lib/twitter.rb
deedubs-twitter-0.8.0 lib/twitter.rb
erwaller-twitter-0.6.13.1 lib/twitter.rb
erwaller-twitter-0.6.15 lib/twitter.rb