public
Rubygem
Description: command line tweets and an api wrapper for twitter
Homepage: http://twitter.rubyforge.org/
Clone URL: git://github.com/jnunemaker/twitter.git
Click here to lend your support to: twitter and make a donation at www.pledgie.com !
twitter / README.txt
100644 84 lines (55 sloc) 2.576 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
= addicted to twitter
 
... a sweet little diddy that helps you twitter your life away
 
== Install
 
sudo gem install twitter will work just fine. For command line use, you'll need a few other gems: sudo gem install main highline activerecord sqlite3-ruby
 
== Examples
 
  Twitter::Base.new('your email', 'your password').update('watching veronica mars')
  
  # or you can use post
  Twitter::Base.new('your email', 'your password').post('post works too')
 
  puts "Public Timeline", "=" * 50
  Twitter::Base.new('your email', 'your password').timeline(:public).each do |s|
   puts s.text, s.user.name
   puts
  end
 
  puts '', "Friends Timeline", "=" * 50
  Twitter::Base.new('your email', 'your password').timeline.each do |s|
   puts s.text, s.user.name
   puts
  end
 
  puts '', "Friends", "=" * 50
  Twitter::Base.new('your email', 'your password').friends.each do |u|
   puts u.name, u.status.text
   puts
  end
 
  puts '', "Followers", "=" * 50
  Twitter::Base.new('your email', 'your password').followers.each do |u|
   puts u.name, u.status.text
   puts
  end
  
== Search Examples
 
  Twitter::Search.new('httparty').each { |r| puts r.inspect }
  Twitter::Search.new('httparty').from('jnunemaker').each { |r| puts r.inspect }
  Twitter::Search.new.from('jnunemaker').to('oaknd1').each { |r| puts r.inspect }
  
 
== Command Line Use
 
Note: If you want to use twitter from the command line be sure that sqlite3 and the sqlite3-ruby gem are installed. I removed the sqlite3-ruby gem as a dependency because you shouldn't need that to just use the API wrapper. Eventually I'll move the CLI interface into another gem.
  
  $ twitter
 
Will give you a list of all the commands. You can get the help for each command by running twitter [command] -h.
 
The first thing you'll want to do is install the database so your account(s) can be stored.
 
  $ twitter install
  
You can always uninstall twitter like this:
 
  $ twitter uninstall
  
Once the twitter database is installed and migrated, you can add accounts like this:
 
  $ twitter add
  Add New Account:
  Username: jnunemaker
  Password (won't be displayed):
  Account added.
 
You can also list all the accounts you've added.
 
  $ twitter list
  Account List
  * jnunemaker
   snitch_test
 
The * means denotes the account that will be used when posting, befriending, defriending, following, leaving or viewing a timeline.
 
To post using the account marked with the *, simply type the following:
 
  $ twitter post "releasing my new twitter gem"
 
That is about it. You can do pretty much anything that you can do with twitter from the command line interface.