Class: GridCLI::DislikeCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- GridCLI::DislikeCommand
- Defined in:
- lib/gridcli/commands/dislike.rb
Instance Attribute Summary
Attributes inherited from BaseCommand
Instance Method Summary collapse
-
#initialize ⇒ DislikeCommand
constructor
A new instance of DislikeCommand.
- #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 ⇒ DislikeCommand
Returns a new instance of DislikeCommand.
3 4 5 6 |
# File 'lib/gridcli/commands/dislike.rb', line 3 def initialize super "dislike", "Dislike something. Specify friends/subgrids to restrict recipients." 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/dislike.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 dislike '#{body}' to your friends" post = Post::Dislike.create :body => body, :recipients => recipients, :posttype => 'dislike' rescue ActiveResource::ClientError puts "There was an error sending your dislike. Please make sure it's not empty." return end puts "Dislike posted." end |
#usage ⇒ Object
8 9 10 |
# File 'lib/gridcli/commands/dislike.rb', line 8 def usage super "<dislike> [<username>[,<username>]]" end |