Skip to content

Commit

Permalink
Added several new methods such as #friendship_exists?, #update_locati…
Browse files Browse the repository at this point in the history
…on, #update_delivery_device, #favorites, #create_favorite, #destroy_favorite, #block, #unblock. Broke backwords compatibility with all the methods that used lite or since as parameters. See note in History.txt for more info on that.
  • Loading branch information
jnunemaker committed Jul 23, 2008
1 parent 7bb265c commit eeca67c
Show file tree
Hide file tree
Showing 17 changed files with 337 additions and 59 deletions.
20 changes: 19 additions & 1 deletion History.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
0.2.8 - July 22, 2008
0.3.0 - July 22, 2008
* complete rewrite of CLI. Now supports multiple accounts and changing between them.
* added source, truncated, in_reply_to_status_id, in_reply_to_user_id, and favorited to Twitter::Status
* added protected to Twitter::User
* d CLI method now takes standard input like post
* Rewrote several methods that had since parameter to now use a hash instead. This makes it more flexible as API updates.
* Rewrote the methods that took lite or since as an argument to instead take a hash.
* added Twitter::Base#friendship_exists?
* added Twitter::Base#update_location
* added Twitter::Base#update_delivery_device
* added Twitter::Base#favorites
* added Twitter::Base#create_favorite
* added Twitter::Base#destroy_favorite
* added Twitter::Base#block
* added Twitter::Base#unblock

BACKWORDS COMPATIBILITY BREAK:
Any method that you have using lite or since as an argument
will no longer work with this version. Simply change to a
hash and you'll be fine. For example:

friends(true) would now be friends(:lite => true)

0.2.7 - June 29, 2008
* added #rate_limit_status (Daniel Morrison)
* added source parameter option to Base#post
Expand Down
10 changes: 10 additions & 0 deletions Manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ Rakefile
bin/twitter
config/hoe.rb
config/requirements.rb
examples/blocks.rb
examples/direct_messages.rb
examples/favorites.rb
examples/friends_followers.rb
examples/friendships.rb
examples/location.rb
examples/replies.rb
examples/sent_messages.rb
examples/timeline.rb
examples/twitter.rb
examples/verify_credentials.rb
lib/twitter.rb
lib/twitter/base.rb
lib/twitter/cli.rb
Expand Down
9 changes: 8 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
require 'config/requirements'
require 'config/hoe' # setup Hoe + all gem configuration

Dir['tasks/**/*.rake'].each { |rake| load rake }
Dir['tasks/**/*.rake'].each { |rake| load rake }

task :build_gemspec_filelist do
files = File.read(File.join(File.dirname(__FILE__), 'Manifest.txt')).split("\n")
puts
puts files.inspect
puts
end
15 changes: 15 additions & 0 deletions examples/blocks.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'rubygems'
require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
config = YAML::load(open(ENV['HOME'] + '/.twitter'))

twitter = Twitter::Base.new(config['email'], config['password'])

puts 'BLOCK CREATE'
puts twitter.block('project_rockne').name
puts
puts

puts 'BLOCK DESTROY'
puts twitter.block('project_rockne').name
puts
puts
26 changes: 26 additions & 0 deletions examples/direct_messages.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'rubygems'
require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
config = YAML::load(open(ENV['HOME'] + '/.twitter'))

twitter = Twitter::Base.new(config['email'], config['password'])

puts 'SINCE'
twitter.direct_messages(:since => Time.now - 5.day).each do |s|
puts "- #{s.text}"
end
puts
puts

puts 'SINCE_ID'
twitter.direct_messages(:since_id => 33505386).each do |s|
puts "- #{s.text}"
end
puts
puts

puts 'PAGE'
twitter.direct_messages(:page => 1).each do |s|
puts "- #{s.text}"
end
puts
puts
20 changes: 20 additions & 0 deletions examples/favorites.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'rubygems'
require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
config = YAML::load(open(ENV['HOME'] + '/.twitter'))

twitter = Twitter::Base.new(config['email'], config['password'])

puts 'FAVORITES'
twitter.favorites.each { |f| puts f.text }
puts
puts

puts 'CREATE'
puts twitter.create_favorite(865416114).text
puts
puts

puts 'DESTROY'
puts twitter.destroy_favorite(865416114).text
puts
puts
25 changes: 25 additions & 0 deletions examples/friends_followers.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'rubygems'
require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
config = YAML::load(open(ENV['HOME'] + '/.twitter'))

twitter = Twitter::Base.new(config['email'], config['password'])

puts "FRIENDS"
twitter.friends.each { |f| puts f.name }
puts
puts

puts "FRIENDS FOR"
twitter.friends_for('orderedlist', :lite => true).each { |f| puts f.name }
puts
puts

puts "FOLLOWERS"
twitter.followers(:lite => true).each { |f| puts f.name }
puts
puts

puts "FOLLOWERS FOR"
twitter.followers_for('orderedlist', :lite => true).each { |f| puts f.name }
puts
puts
13 changes: 13 additions & 0 deletions examples/friendships.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'rubygems'
require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
config = YAML::load(open(ENV['HOME'] + '/.twitter'))

twitter = Twitter::Base.new(config['email'], config['password'])

puts twitter.create_friendship('orderedlist').name
puts twitter.follow('orderedlist').name
puts twitter.leave('orderedlist').name
puts twitter.destroy_friendship('orderedlist').name

puts twitter.friendship_exists?('jnunemaker', 'orderedlist').inspect
puts twitter.friendship_exists?('jnunemaker', 'ze').inspect
8 changes: 8 additions & 0 deletions examples/location.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'rubygems'
require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
config = YAML::load(open(ENV['HOME'] + '/.twitter'))

twitter = Twitter::Base.new(config['email'], config['password'])

puts twitter.update_location('Hollywood, CA').location
puts twitter.update_delivery_device('none')
26 changes: 26 additions & 0 deletions examples/replies.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'rubygems'
require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
config = YAML::load(open(ENV['HOME'] + '/.twitter'))

twitter = Twitter::Base.new(config['email'], config['password'])

puts 'SINCE'
twitter.replies(:since => Time.now - 5.day).each do |s|
puts "- #{s.text}"
end
puts
puts

puts 'SINCE_ID'
twitter.replies(:since_id => 863081345).each do |s|
puts "- #{s.text}"
end
puts
puts

puts 'PAGE'
twitter.replies(:page => 1).each do |s|
puts "- #{s.text}"
end
puts
puts
26 changes: 26 additions & 0 deletions examples/sent_messages.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'rubygems'
require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
config = YAML::load(open(ENV['HOME'] + '/.twitter'))

twitter = Twitter::Base.new(config['email'], config['password'])

puts 'SINCE'
twitter.sent_messages(:since => Time.now - 5.day).each do |s|
puts "- #{s.text}"
end
puts
puts

puts 'SINCE_ID'
twitter.sent_messages(:since_id => 33505386).each do |s|
puts "- #{s.text}"
end
puts
puts

puts 'PAGE'
twitter.sent_messages(:page => 1).each do |s|
puts "- #{s.text}"
end
puts
puts
33 changes: 33 additions & 0 deletions examples/timeline.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
require 'rubygems'
require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
config = YAML::load(open(ENV['HOME'] + '/.twitter'))

twitter = Twitter::Base.new(config['email'], config['password'])

puts 'SINCE'
twitter.timeline(:user, :since => Time.now - 1.day).each do |s|
puts "- #{s.text}"
end
puts
puts

puts 'SINCE_ID'
twitter.timeline(:user, :since_id => 865368201).each do |s|
puts "- #{s.text}"
end
puts
puts

puts 'COUNT'
twitter.timeline(:user, :count => 1).each do |s|
puts "- #{s.text}"
end
puts
puts

puts 'PAGE'
twitter.timeline(:user, :page => 1).each do |s|
puts "- #{s.text}"
end
puts
puts
13 changes: 13 additions & 0 deletions examples/verify_credentials.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'rubygems'
require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
config = YAML::load(open(ENV['HOME'] + '/.twitter'))

twitter = Twitter::Base.new(config['email'], config['password'])

puts twitter.verify_credentials

begin
Twitter::Base.new('asdf', 'foobar').verify_credentials
rescue => error
puts error.message
end
Loading

0 comments on commit eeca67c

Please sign in to comment.