Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added d to command line client

git-svn-id: http://svn.addictedtonew.com/public/gems/twitter@165 fe7eae16-9a24-0410-a59d-9e59979e88be
  • Loading branch information...
commit a9ecddd3323ef202248dae59d049b00b88b76b4e 1 parent 4878689
jnunemaker authored
Showing with 19 additions and 2 deletions.
  1. +2 −0  CHANGELOG
  2. +16 −1 lib/twitter/command.rb
  3. +1 −1  lib/twitter/version.rb
View
2  CHANGELOG
@@ -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
View
17 lib/twitter/command.rb
@@ -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
@@ -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
View
2  lib/twitter/version.rb
@@ -2,7 +2,7 @@ module Twitter #:nodoc:
module VERSION #:nodoc:
MAJOR = 0
MINOR = 2
- TINY = 2
+ TINY = 3
STRING = [MAJOR, MINOR, TINY].join('.')
end
Please sign in to comment.
Something went wrong with that request. Please try again.