Skip to content

Commit

Permalink
updated to add visual progress dots during post in case twitter is sl…
Browse files Browse the repository at this point in the history
…ow; added d message in CLI

git-svn-id: http://svn.addictedtonew.com/public/gems/twitter@166 fe7eae16-9a24-0410-a59d-9e59979e88be
  • Loading branch information
jnunemaker committed Jan 17, 2008
1 parent a9ecddd commit 02a24d9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 17 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.2.3 - Jan 16, 2008
* added d to command line interface twitter d jnunemaker 'hola'
* added d to command line interface twitter d jnunemaker 'hola' (Humbucker)
* added progress dots when posting for confirmation when twitter is running slow (Hendy Irawan)
0.2.2 - added leave and follow which are new twitter api methods for turning notifications on and off
0.2.0 - Aug 4, 2007
* added sent_messages
Expand Down
1 change: 0 additions & 1 deletion lib/twitter/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class BadResponse < Untwitterable; end
class UnknownTimeline < ArgumentError; end

class Base

# Twitter's url, duh!
@@api_url = 'twitter.com'

Expand Down
15 changes: 12 additions & 3 deletions lib/twitter/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,18 @@ def post
end

post = ARGV.shift

status = Twitter::Base.new(config['email'], config['password']).post(post)
puts "\nGot it! New twitter created at: #{status.created_at}\n"
print "\nSending twitter update"
finished = false
status = nil
progress_thread = Thread.new { until finished; print "."; $stdout.flush; sleep 0.5; end; }
post_thread = Thread.new(binding()) { |b|
status = Twitter::Base.new(config['email'], config['password']).post(post)
finished = true
}
post_thread.join
progress_thread.join
puts " OK!"
puts "Got it! New twitter created at: #{status.created_at}\n"
end

# Shows status, time and user for the specified timeline
Expand Down
24 changes: 12 additions & 12 deletions test/unit/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class BaseTest < Test::Unit::TestCase
def setup
# note to self use webgroup
@t = Twitter::Base.new(CONFIG['email'], CONFIG['password'])
end

Expand Down Expand Up @@ -66,8 +67,8 @@ def setup
end

test 'should be able to create and destroy friendships' do
puts "Destroying Friendship with Snitch Test", @t.destroy_friendship('snitch_test'), "*"*50
puts "Creating Friendship with Snitch Test", @t.create_friendship('snitch_test'), "*"*50
puts "Destroying Friendship", @t.destroy_friendship('jnunemaker'), "*"*50
puts "Creating Friendship", @t.create_friendship('jnunemaker'), "*"*50
end

test 'should be able to follow a user' do
Expand All @@ -79,14 +80,13 @@ def setup
end


#
# test 'should be able to destroy a status' do
# # this has to be checked individually, create a status, put the id in and make sure it was deleted
# #@t.destroy(185855442)
# end
#
# test 'should be able to destroy a direct message' do
# # must be tested individually
# @t.destroy_direct_message(4687032)
# end
test 'should be able to destroy a status' do
# this has to be checked individually, create a status, put the id in and make sure it was deleted
#@t.destroy(185855442)
end

test 'should be able to destroy a direct message' do
# must be tested individually
@t.destroy_direct_message(4687032)
end
end

0 comments on commit 02a24d9

Please sign in to comment.