Pupil

The "Lazy" Twitter API Library for Ruby

This project is maintained by oame

Pupil

Pupil is "Lazy" Twitter API Library for Ruby 1.9.x.

Features

Problems

Requirement

Installation

gem install pupil

Examples

require "pupil"

oauth_key = {
    :consumer_key => "something",
    :consumer_secret => "something",
    :access_token => "something",
    :access_token_secret => "something"
}

pupil = Pupil.new oauth_key

# Get timeline statuses without replies
pupil.timeline :count => 50, :exclude => :replies

# Follow User
pupil.follow :twitterapi

# Update URL on profile
pupil.update_profile :url => "http://oameya.com"

Using Streaming API

require "pupil/stream"

oauth_key = {
    :consumer_key => "something",
    :consumer_secret => "something",
    :access_token => "something",
    :access_token_secret => "something"
}

stream = Pupil::Stream.new oauth_key

# Userstream
stream.start :userstream do |status|
    if status.event == :retweeted
        puts "This is retweeted status! => #{status.text}"
    end
end

# Search stream
stream.start :search, :track => "#MerryChristmas" do |status|
    puts "Merry christmas, #{status.user.screen_name}!"
end

Making oauth_key

require "pupil/keygen"

keygen = Pupil::Keygen.new
keygen.interactive #=> Generate pupil_key interactively

Eyedrops, the interactive Pupil

> eyedrops -h
> eyedrops -u [name] -i
eyedrops> twitter.timeline :count => 10
...

Contributing to pupil

Credits

Developer: Oame

License

Copyright (c) 2011 Oame. See LICENSE for further details.