Class: GridCLI::StatusCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- GridCLI::StatusCommand
- Defined in:
- lib/gridcli/commands/status.rb
Instance Attribute Summary
Attributes inherited from BaseCommand
Instance Method Summary collapse
-
#initialize ⇒ StatusCommand
constructor
A new instance of StatusCommand.
- #run(args) ⇒ Object
- #usage ⇒ Object
Methods inherited from BaseCommand
#add_format_option, #add_option, #error, #log, #output_format, #parse_dates, #parse_opts, #pop_arg, #pprint
Constructor Details
#initialize ⇒ StatusCommand
Returns a new instance of StatusCommand.
3 4 5 6 |
# File 'lib/gridcli/commands/status.rb', line 3 def initialize super "status", "Send a status update to all friends (or specific ones)." add_format_option end |
Instance Method Details
#run(args) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gridcli/commands/status.rb', line 12 def run(args) usage if args.length == 0 body = args.shift recipients = pop_arg(args, "friends") parse_opts args begin log "Trying to send a status update '#{body}' to your friends" post = Post::Status.create :body => body, :recipients => recipients, :posttype => 'status' rescue ActiveResource::ClientError puts "There was an error sending your status. Please make sure it's not empty." return end puts "Status posted." end |
#usage ⇒ Object
8 9 10 |
# File 'lib/gridcli/commands/status.rb', line 8 def usage super "<status> [<username>[,<username>]]" end |