Skip to content

Commit

Permalink
added d to command line client
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.addictedtonew.com/public/gems/twitter@165 fe7eae16-9a24-0410-a59d-9e59979e88be
  • Loading branch information
jnunemaker committed Jan 17, 2008
1 parent 4878689 commit a9ecddd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
0.2.3 - Jan 16, 2008
* added d to command line interface twitter d jnunemaker 'hola'
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
17 changes: 16 additions & 1 deletion lib/twitter/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# It is only used and included in the bin/twitter file.
module Twitter
class Command
@@commands = [:post, :timeline, :friends, :friend, :followers, :follower, :featured, :important, :follow, :leave]
@@commands = [:post, :timeline, :friends, :friend, :followers, :follower, :featured, :important, :follow, :leave, :d]

@@template = <<EOF
# .twitter
Expand Down Expand Up @@ -202,6 +202,21 @@ def leave
end
end

# Posts a direct message to twitter
def d
config = create_or_find_config
if ARGV.size != 2
puts %(\n You didn't do it right.\n\n Usage: twitter d jnunemaker "You're fabulous message"\n)
exit(0)
end

user = ARGV.shift
post = ARGV.shift

status = Twitter::Base.new(config['email'], config['password']).d(user, post)
puts "\nDirect message sent to #{user}.\n"
end

private
# Checks for the config, creates it if not found
def create_or_find_config
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Twitter #:nodoc:
module VERSION #:nodoc:
MAJOR = 0
MINOR = 2
TINY = 2
TINY = 3

STRING = [MAJOR, MINOR, TINY].join('.')
end
Expand Down

0 comments on commit a9ecddd

Please sign in to comment.