dustin-twitter 0.3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. data/History.txt +89 -0
  2. data/License.txt +19 -0
  3. data/Manifest.txt +66 -0
  4. data/README.txt +75 -0
  5. data/Rakefile +4 -0
  6. data/TODO.txt +2 -0
  7. data/bin/twitter +15 -0
  8. data/config/hoe.rb +74 -0
  9. data/config/requirements.rb +17 -0
  10. data/examples/blocks.rb +15 -0
  11. data/examples/direct_messages.rb +26 -0
  12. data/examples/favorites.rb +20 -0
  13. data/examples/friends_followers.rb +25 -0
  14. data/examples/friendships.rb +13 -0
  15. data/examples/location.rb +8 -0
  16. data/examples/replies.rb +26 -0
  17. data/examples/sent_messages.rb +26 -0
  18. data/examples/timeline.rb +33 -0
  19. data/examples/twitter.rb +27 -0
  20. data/examples/verify_credentials.rb +13 -0
  21. data/lib/twitter/base.rb +248 -0
  22. data/lib/twitter/cli/config.rb +9 -0
  23. data/lib/twitter/cli/helpers.rb +97 -0
  24. data/lib/twitter/cli/migrations/20080722194500_create_accounts.rb +13 -0
  25. data/lib/twitter/cli/migrations/20080722194508_create_tweets.rb +16 -0
  26. data/lib/twitter/cli/migrations/20080722214605_add_account_id_to_tweets.rb +9 -0
  27. data/lib/twitter/cli/migrations/20080722214606_create_configurations.rb +13 -0
  28. data/lib/twitter/cli/models/account.rb +33 -0
  29. data/lib/twitter/cli/models/configuration.rb +13 -0
  30. data/lib/twitter/cli/models/tweet.rb +20 -0
  31. data/lib/twitter/cli.rb +328 -0
  32. data/lib/twitter/direct_message.rb +22 -0
  33. data/lib/twitter/easy_class_maker.rb +43 -0
  34. data/lib/twitter/rate_limit_status.rb +19 -0
  35. data/lib/twitter/status.rb +22 -0
  36. data/lib/twitter/user.rb +37 -0
  37. data/lib/twitter/version.rb +9 -0
  38. data/lib/twitter.rb +20 -0
  39. data/script/destroy +14 -0
  40. data/script/generate +14 -0
  41. data/script/txt2html +74 -0
  42. data/setup.rb +1585 -0
  43. data/spec/base_spec.rb +109 -0
  44. data/spec/cli/helper_spec.rb +35 -0
  45. data/spec/direct_message_spec.rb +35 -0
  46. data/spec/fixtures/followers.xml +706 -0
  47. data/spec/fixtures/friends.xml +609 -0
  48. data/spec/fixtures/friends_for.xml +584 -0
  49. data/spec/fixtures/friends_lite.xml +192 -0
  50. data/spec/fixtures/friends_timeline.xml +66 -0
  51. data/spec/fixtures/public_timeline.xml +148 -0
  52. data/spec/fixtures/rate_limit_status.xml +7 -0
  53. data/spec/fixtures/status.xml +25 -0
  54. data/spec/fixtures/user.xml +38 -0
  55. data/spec/fixtures/user_timeline.xml +465 -0
  56. data/spec/spec.opts +1 -0
  57. data/spec/spec_helper.rb +8 -0
  58. data/spec/status_spec.rb +40 -0
  59. data/spec/user_spec.rb +42 -0
  60. data/tasks/deployment.rake +41 -0
  61. data/tasks/environment.rake +7 -0
  62. data/tasks/website.rake +17 -0
  63. data/twitter.gemspec +49 -0
  64. data/website/css/common.css +47 -0
  65. data/website/images/terminal_output.png +0 -0
  66. data/website/index.html +138 -0
  67. metadata +176 -0
data/History.txt ADDED
@@ -0,0 +1,89 @@
1
+ 0.3.2 - July 26, 2008
2
+ * added the CLI gems as dependencies for now until I separate out the CLI from the API wrapper
3
+ * cleaner CLI errors for no active account or no accounts at all
4
+ * remove sets a new active account if there are none
5
+ * added username and password optional arguments to add
6
+ * added import attempt on install and on anything that uses #current_account helper
7
+
8
+ 0.3.1 - July 23, 2008
9
+ * added open to CLI twitter open jnunemaker would open default browser to http://twitter.com/jnunemaker
10
+ * added -f to timeline and replies which ignores the since_id and shows all results
11
+ * added clear_config to remove all cached since id's and such
12
+ * Majorly pimped the output of timelines and replies.
13
+
14
+ 0.3.0 - July 22, 2008
15
+ * complete rewrite of CLI. Now supports multiple accounts and changing between them.
16
+ * added source, truncated, in_reply_to_status_id, in_reply_to_user_id, and favorited to Twitter::Status
17
+ * added protected to Twitter::User
18
+ * d CLI method now takes standard input like post
19
+ * Rewrote several methods that had since parameter to now use a hash instead. This makes it more flexible as API updates.
20
+ * Rewrote the methods that took lite or since as an argument to instead take a hash.
21
+ * added Twitter::Base#friendship_exists?
22
+ * added Twitter::Base#update_location
23
+ * added Twitter::Base#update_delivery_device
24
+ * added Twitter::Base#favorites
25
+ * added Twitter::Base#create_favorite
26
+ * added Twitter::Base#destroy_favorite
27
+ * added Twitter::Base#block
28
+ * added Twitter::Base#unblock
29
+
30
+ BACKWORDS COMPATIBILITY BREAK:
31
+ Any method that you have using lite or since as an argument
32
+ will no longer work with this version. Simply change to a
33
+ hash and you'll be fine. For example:
34
+
35
+ friends(true) would now be friends(:lite => true)
36
+
37
+ 0.2.7 - June 29, 2008
38
+ * added #rate_limit_status (Daniel Morrison)
39
+ * added source parameter option to Base#post
40
+ * added twittergem as source when posting from command line
41
+ * Twitter::RateExceeded raised when you hit your limit (Jim O'Leary)
42
+ * Twitter::Unavailable raised when twitter returns 503
43
+ * Twitter::CantConnect is now more descriptive as to what is the problem when it is raised during a request
44
+ * quoting your message when using twitter post on the command line is now optional (Benoit Caccinolo)
45
+ * aliased post to p on command line so it's shorter (Benoit Caccinolo)
46
+ * unescaped html and added some color in command line view (Miles Z. Sterrett)
47
+ * added gemspec (technoweenie, Miles Z. Sterrett)
48
+ * Fixed stack trace error on first command line operation (Matt Rose)
49
+ 0.2.6 - April 2, 2008
50
+ * found a more simple way of doing stdin without any extra gem dependencies
51
+ 0.2.5 - April 2, 2008
52
+ * Command line interface can now use stdin for posting (ideas and example code from Jeremy Friesen)
53
+ $ twitter post 'test without stdin' # => twitters: test without stdin
54
+ $ echo 'test with stdin' | twitter post 'and an argv[1]' # => twitters: test with stdin and an argv[1]
55
+ $ echo 'test with stdin without any argv[1]' | twitter post # => twitters: test with stdin without any argv[1]
56
+ 0.2.4 - Mar 31, 2008
57
+ * Added lite option to friends and followers, which doesn't include the user's current status (Daniel Morrison)
58
+ * Updated since option to use HTTP header, and added the option on timeline() and replies(). (Daniel Morrison)
59
+ 0.2.3 - Jan 16, 2008
60
+ * added d to command line interface twitter d jnunemaker 'hola' (Humbucker)
61
+ * added progress dots when posting for confirmation when twitter is running slow (Hendy Irawan)
62
+ 0.2.2 - added leave and follow which are new twitter api methods for turning notifications on and off
63
+ 0.2.0 - Aug 4, 2007
64
+ * added sent_messages
65
+ * alias direct_messages to received_messages
66
+ * added create_friendship
67
+ * added destroy_friendship
68
+ * added featured to retrieve the featured twitter users
69
+ * added replies
70
+ * added destroy to destroy a status by id
71
+ * added status to find a status by id
72
+ * added active support as an extra dependency
73
+ * implemented d method to send direct messages (jnewland)
74
+ * fixed since argument in direct_messages method (jnewland)
75
+ 0.1.1 - May 20, 2007
76
+ * hpricot 0.5+ now supported; just a bug fix (Ryan Waldron is the man!)
77
+ 0.1.0 - March 31, 2007
78
+ * added d method for creating direct messages (waiting for it to work as documented)
79
+ * added featured method for getting featured users statuses (waiting for it to work as documented)
80
+ * added direct_messages method
81
+ * added friends_for method
82
+ * added a few tests
83
+ * removed relative_created_at as it is deprecated
84
+ * separated out the call method into call, request and parse methods
85
+ 0.0.5 - just a bit of code cleanup
86
+ 0.0.4 - added :location, :description, :url, :profile_image_url to user class (Alex Payne)
87
+ 0.0.3 - added a bit more informative message when things go wrong
88
+ 0.0.2 - added the command line options i forgot to add (friend and follower); improved some docs
89
+ 0.0.1 - initial release
data/License.txt ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2007 John Nunemaker
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/Manifest.txt ADDED
@@ -0,0 +1,66 @@
1
+ History.txt
2
+ License.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ TODO.txt
7
+ bin/twitter
8
+ config/hoe.rb
9
+ config/requirements.rb
10
+ examples/blocks.rb
11
+ examples/direct_messages.rb
12
+ examples/favorites.rb
13
+ examples/friends_followers.rb
14
+ examples/friendships.rb
15
+ examples/location.rb
16
+ examples/replies.rb
17
+ examples/sent_messages.rb
18
+ examples/timeline.rb
19
+ examples/twitter.rb
20
+ examples/verify_credentials.rb
21
+ lib/twitter.rb
22
+ lib/twitter/base.rb
23
+ lib/twitter/cli.rb
24
+ lib/twitter/cli/config.rb
25
+ lib/twitter/cli/helpers.rb
26
+ lib/twitter/cli/migrations/20080722194500_create_accounts.rb
27
+ lib/twitter/cli/migrations/20080722194508_create_tweets.rb
28
+ lib/twitter/cli/migrations/20080722214605_add_account_id_to_tweets.rb
29
+ lib/twitter/cli/migrations/20080722214606_create_configurations.rb
30
+ lib/twitter/cli/models/account.rb
31
+ lib/twitter/cli/models/configuration.rb
32
+ lib/twitter/cli/models/tweet.rb
33
+ lib/twitter/direct_message.rb
34
+ lib/twitter/easy_class_maker.rb
35
+ lib/twitter/rate_limit_status.rb
36
+ lib/twitter/status.rb
37
+ lib/twitter/user.rb
38
+ lib/twitter/version.rb
39
+ script/destroy
40
+ script/generate
41
+ script/txt2html
42
+ setup.rb
43
+ spec/base_spec.rb
44
+ spec/cli/helper_spec.rb
45
+ spec/direct_message_spec.rb
46
+ spec/fixtures/followers.xml
47
+ spec/fixtures/friends.xml
48
+ spec/fixtures/friends_for.xml
49
+ spec/fixtures/friends_lite.xml
50
+ spec/fixtures/friends_timeline.xml
51
+ spec/fixtures/public_timeline.xml
52
+ spec/fixtures/rate_limit_status.xml
53
+ spec/fixtures/status.xml
54
+ spec/fixtures/user.xml
55
+ spec/fixtures/user_timeline.xml
56
+ spec/spec.opts
57
+ spec/spec_helper.rb
58
+ spec/status_spec.rb
59
+ spec/user_spec.rb
60
+ tasks/deployment.rake
61
+ tasks/environment.rake
62
+ tasks/website.rake
63
+ twitter.gemspec
64
+ website/css/common.css
65
+ website/images/terminal_output.png
66
+ website/index.html
data/README.txt ADDED
@@ -0,0 +1,75 @@
1
+ = addicted to twitter
2
+
3
+ ... a sweet little diddy that helps you twitter your life away
4
+
5
+ == Install
6
+
7
+ 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
8
+
9
+ == Examples
10
+
11
+ Twitter::Base.new('your email', 'your password').update('watching veronica mars')
12
+
13
+ # or you can use post
14
+ Twitter::Base.new('your email', 'your password').post('post works too')
15
+
16
+ puts "Public Timeline", "=" * 50
17
+ Twitter::Base.new('your email', 'your password').timeline(:public).each do |s|
18
+ puts s.text, s.user.name
19
+ puts
20
+ end
21
+
22
+ puts '', "Friends Timeline", "=" * 50
23
+ Twitter::Base.new('your email', 'your password').timeline.each do |s|
24
+ puts s.text, s.user.name
25
+ puts
26
+ end
27
+
28
+ puts '', "Friends", "=" * 50
29
+ Twitter::Base.new('your email', 'your password').friends.each do |u|
30
+ puts u.name, u.status.text
31
+ puts
32
+ end
33
+
34
+ puts '', "Followers", "=" * 50
35
+ Twitter::Base.new('your email', 'your password').followers.each do |u|
36
+ puts u.name, u.status.text
37
+ puts
38
+ end
39
+
40
+ == Command Line Use
41
+
42
+ $ twitter
43
+
44
+ Will give you a list of all the commands. You can get the help for each command by running twitter [command] -h.
45
+
46
+ The first thing you'll want to do is install the database so your account(s) can be stored.
47
+
48
+ $ twitter install
49
+
50
+ You can always uninstall twitter like this:
51
+
52
+ $ twitter uninstall
53
+
54
+ Once the twitter database is installed and migrated, you can add accounts like this:
55
+
56
+ $ twitter add
57
+ Add New Account:
58
+ Username: jnunemaker
59
+ Password (won't be displayed):
60
+ Account added.
61
+
62
+ You can also list all the accounts you've added.
63
+
64
+ $ twitter list
65
+ Account List
66
+ * jnunemaker
67
+ snitch_test
68
+
69
+ The * means denotes the account that will be used when posting, befriending, defriending, following, leaving or viewing a timeline.
70
+
71
+ To post using the account marked with the *, simply type the following:
72
+
73
+ $ twitter post "releasing my new twitter gem"
74
+
75
+ That is about it. You can do pretty much anything that you can do with twitter from the command line interface.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'config/requirements'
2
+ require 'config/hoe' # setup Hoe + all gem configuration
3
+
4
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
data/TODO.txt ADDED
@@ -0,0 +1,2 @@
1
+ * add timeout so it doesn't hang forever like it does now if twitter is down
2
+ * add progress indicator for timeline and replies as posting has for more visual indication that work is happening
data/bin/twitter ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # if we have stdin, let's prepend it to the message for post
4
+ if ARGV[0] && ARGV[0] == 'post' && !STDIN.tty?
5
+ ARGV[1] = "#{STDIN.read}#{ARGV[1]}"
6
+ end
7
+
8
+ # if we have stdin, let's prepend it to the message for d
9
+ if ARGV[0] && ARGV[0] == 'd' && !STDIN.tty?
10
+ ARGV[2] = "#{STDIN.read}#{ARGV[2]}"
11
+ end
12
+
13
+ $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
14
+ require 'twitter'
15
+ require 'twitter/cli'
data/config/hoe.rb ADDED
@@ -0,0 +1,74 @@
1
+ require 'twitter/version'
2
+
3
+ AUTHOR = "John Nunemaker" # can also be an array of Authors
4
+ EMAIL = "nunemaker@gmail.com"
5
+ DESCRIPTION = "a command line interface for twitter, also a library which wraps the twitter api"
6
+ GEM_NAME = "twitter" # what ppl will type to install your gem
7
+ RUBYFORGE_PROJECT = "twitter" # The unix name for your project
8
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
+ RELEASE_TYPES = %w( gem ) # can use: gem, tar, zip
10
+ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
11
+
12
+ @config_file = "~/.rubyforge/user-config.yml"
13
+ @config = nil
14
+ RUBYFORGE_USERNAME = "unknown"
15
+ def rubyforge_username
16
+ unless @config
17
+ begin
18
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
19
+ rescue
20
+ puts <<-EOS
21
+ ERROR: No rubyforge config file found: #{@config_file}
22
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
23
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
24
+ EOS
25
+ exit
26
+ end
27
+ end
28
+ RUBYFORGE_USERNAME.replace @config["username"]
29
+ end
30
+
31
+
32
+ REV = nil
33
+ # UNCOMMENT IF REQUIRED:
34
+ # REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
35
+ VERS = Twitter::VERSION::STRING + (REV ? ".#{REV}" : "")
36
+ RDOC_OPTS = ['--quiet', '--title', 'twitter documentation',
37
+ "--opname", "index.html",
38
+ "--line-numbers",
39
+ "--main", "README",
40
+ "--inline-source"]
41
+
42
+ class Hoe
43
+ def extra_deps
44
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
45
+ @extra_deps
46
+ end
47
+ end
48
+
49
+ # Generate all the Rake tasks
50
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
51
+ hoe = Hoe.new(GEM_NAME, VERS) do |p|
52
+ p.author = AUTHOR
53
+ p.description = DESCRIPTION
54
+ p.email = EMAIL
55
+ p.summary = DESCRIPTION
56
+ p.url = HOMEPATH
57
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
58
+ p.test_globs = ["test/**/test_*.rb"]
59
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
60
+
61
+ # == Optional
62
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
63
+ #p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
64
+ p.extra_deps = [['hpricot', '>= 0.6'], ['activesupport', '>= 2.1'],
65
+ ['main', '>= 2.8.2'], ['highline', '>= 1.4.0'],
66
+ ['activerecord', '>= 2.1'], ['sqlite3-ruby', '>= 1.2.2']]
67
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
68
+
69
+ end
70
+
71
+ CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
72
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
73
+ hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
74
+ hoe.rsync_args = '-av --delete --ignore-errors'
@@ -0,0 +1,17 @@
1
+ require 'fileutils'
2
+ include FileUtils
3
+
4
+ require 'rubygems'
5
+ %w[rake hoe newgem rubigen].each do |req_gem|
6
+ begin
7
+ require req_gem
8
+ rescue LoadError
9
+ puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
+ puts "Installation: gem install #{req_gem} -y"
11
+ exit
12
+ end
13
+ end
14
+
15
+ $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
16
+
17
+ require 'twitter'
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
3
+ config = YAML::load(open(ENV['HOME'] + '/.twitter'))
4
+
5
+ twitter = Twitter::Base.new(config['email'], config['password'])
6
+
7
+ puts 'BLOCK CREATE'
8
+ puts twitter.block('project_rockne').name
9
+ puts
10
+ puts
11
+
12
+ puts 'BLOCK DESTROY'
13
+ puts twitter.block('project_rockne').name
14
+ puts
15
+ puts
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
3
+ config = YAML::load(open(ENV['HOME'] + '/.twitter'))
4
+
5
+ twitter = Twitter::Base.new(config['email'], config['password'])
6
+
7
+ puts 'SINCE'
8
+ twitter.direct_messages(:since => Time.now - 5.day).each do |s|
9
+ puts "- #{s.text}"
10
+ end
11
+ puts
12
+ puts
13
+
14
+ puts 'SINCE_ID'
15
+ twitter.direct_messages(:since_id => 33505386).each do |s|
16
+ puts "- #{s.text}"
17
+ end
18
+ puts
19
+ puts
20
+
21
+ puts 'PAGE'
22
+ twitter.direct_messages(:page => 1).each do |s|
23
+ puts "- #{s.text}"
24
+ end
25
+ puts
26
+ puts
@@ -0,0 +1,20 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
3
+ config = YAML::load(open(ENV['HOME'] + '/.twitter'))
4
+
5
+ twitter = Twitter::Base.new(config['email'], config['password'])
6
+
7
+ puts 'FAVORITES'
8
+ twitter.favorites.each { |f| puts f.text }
9
+ puts
10
+ puts
11
+
12
+ puts 'CREATE'
13
+ puts twitter.create_favorite(865416114).text
14
+ puts
15
+ puts
16
+
17
+ puts 'DESTROY'
18
+ puts twitter.destroy_favorite(865416114).text
19
+ puts
20
+ puts
@@ -0,0 +1,25 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
3
+ config = YAML::load(open(ENV['HOME'] + '/.twitter'))
4
+
5
+ twitter = Twitter::Base.new(config['email'], config['password'])
6
+
7
+ puts "FRIENDS"
8
+ twitter.friends.each { |f| puts f.name }
9
+ puts
10
+ puts
11
+
12
+ puts "FRIENDS FOR"
13
+ twitter.friends_for('orderedlist', :lite => true).each { |f| puts f.name }
14
+ puts
15
+ puts
16
+
17
+ puts "FOLLOWERS"
18
+ twitter.followers(:lite => true).each { |f| puts f.name }
19
+ puts
20
+ puts
21
+
22
+ puts "FOLLOWERS FOR"
23
+ twitter.followers_for('orderedlist', :lite => true).each { |f| puts f.name }
24
+ puts
25
+ puts
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
3
+ config = YAML::load(open(ENV['HOME'] + '/.twitter'))
4
+
5
+ twitter = Twitter::Base.new(config['email'], config['password'])
6
+
7
+ puts twitter.create_friendship('orderedlist').name
8
+ puts twitter.follow('orderedlist').name
9
+ puts twitter.leave('orderedlist').name
10
+ puts twitter.destroy_friendship('orderedlist').name
11
+
12
+ puts twitter.friendship_exists?('jnunemaker', 'orderedlist').inspect
13
+ puts twitter.friendship_exists?('jnunemaker', 'ze').inspect
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
3
+ config = YAML::load(open(ENV['HOME'] + '/.twitter'))
4
+
5
+ twitter = Twitter::Base.new(config['email'], config['password'])
6
+
7
+ puts twitter.update_location('Hollywood, CA').location
8
+ puts twitter.update_delivery_device('none')
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
3
+ config = YAML::load(open(ENV['HOME'] + '/.twitter'))
4
+
5
+ twitter = Twitter::Base.new(config['email'], config['password'])
6
+
7
+ puts 'SINCE'
8
+ twitter.replies(:since => Time.now - 5.day).each do |s|
9
+ puts "- #{s.text}"
10
+ end
11
+ puts
12
+ puts
13
+
14
+ puts 'SINCE_ID'
15
+ twitter.replies(:since_id => 863081345).each do |s|
16
+ puts "- #{s.text}"
17
+ end
18
+ puts
19
+ puts
20
+
21
+ puts 'PAGE'
22
+ twitter.replies(:page => 1).each do |s|
23
+ puts "- #{s.text}"
24
+ end
25
+ puts
26
+ puts
@@ -0,0 +1,26 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
3
+ config = YAML::load(open(ENV['HOME'] + '/.twitter'))
4
+
5
+ twitter = Twitter::Base.new(config['email'], config['password'])
6
+
7
+ puts 'SINCE'
8
+ twitter.sent_messages(:since => Time.now - 5.day).each do |s|
9
+ puts "- #{s.text}"
10
+ end
11
+ puts
12
+ puts
13
+
14
+ puts 'SINCE_ID'
15
+ twitter.sent_messages(:since_id => 33505386).each do |s|
16
+ puts "- #{s.text}"
17
+ end
18
+ puts
19
+ puts
20
+
21
+ puts 'PAGE'
22
+ twitter.sent_messages(:page => 1).each do |s|
23
+ puts "- #{s.text}"
24
+ end
25
+ puts
26
+ puts
@@ -0,0 +1,33 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
3
+ config = YAML::load(open(ENV['HOME'] + '/.twitter'))
4
+
5
+ twitter = Twitter::Base.new(config['email'], config['password'])
6
+
7
+ puts 'SINCE'
8
+ twitter.timeline(:user, :since => Time.now - 1.day).each do |s|
9
+ puts "- #{s.text}"
10
+ end
11
+ puts
12
+ puts
13
+
14
+ puts 'SINCE_ID'
15
+ twitter.timeline(:user, :since_id => 865547074).each do |s|
16
+ puts "- #{s.text}"
17
+ end
18
+ puts
19
+ puts
20
+
21
+ puts 'COUNT'
22
+ twitter.timeline(:user, :count => 1).each do |s|
23
+ puts "- #{s.text}"
24
+ end
25
+ puts
26
+ puts
27
+
28
+ puts 'PAGE'
29
+ twitter.timeline(:user, :page => 1).each do |s|
30
+ puts "- #{s.text}"
31
+ end
32
+ puts
33
+ puts
@@ -0,0 +1,27 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
3
+ config = YAML::load(open(ENV['HOME'] + '/.twitter'))
4
+
5
+ puts "Public Timeline", "=" * 50
6
+ Twitter::Base.new(config['email'], config['password']).timeline(:public).each do |s|
7
+ puts s.text, s.user.name
8
+ puts
9
+ end
10
+
11
+ puts '', "Friends Timeline", "=" * 50
12
+ Twitter::Base.new(config['email'], config['password']).timeline.each do |s|
13
+ puts s.text, s.user.name
14
+ puts
15
+ end
16
+
17
+ puts '', "Friends", "=" * 50
18
+ Twitter::Base.new(config['email'], config['password']).friends.each do |u|
19
+ puts u.name, u.status.text
20
+ puts
21
+ end
22
+
23
+ puts '', "Followers", "=" * 50
24
+ Twitter::Base.new(config['email'], config['password']).followers.each do |u|
25
+ puts u.name, u.status.text
26
+ puts
27
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
3
+ config = YAML::load(open(ENV['HOME'] + '/.twitter'))
4
+
5
+ twitter = Twitter::Base.new(config['email'], config['password'])
6
+
7
+ puts twitter.verify_credentials
8
+
9
+ begin
10
+ Twitter::Base.new('asdf', 'foobar').verify_credentials
11
+ rescue => error
12
+ puts error.message
13
+ end