Conversation
slack.rbWhat We're Looking For
|
| tp User.list | ||
|
|
||
| elsif option == "list channels" | ||
| tp Channel.list |
There was a problem hiding this comment.
This doesn't easily surface the name of the channel, making it hard to use!
| end | ||
|
|
||
| if value == 0 | ||
| raise ArgumentError.new("Please provide a valid selection for user.") |
There was a problem hiding this comment.
It's fine to throw an error here, but if you don't catch it, then the program just crashes on bad input.
| message = gets.chomp | ||
| channel.send_message(message) | ||
|
|
||
| elsif option == "send message to user" |
There was a problem hiding this comment.
why do you have a different entry for sending to user and channel? they work the same, and you could use polymorphism to DRY this code to a single block! This also reduces the number of tests you need to write!
| elsif option == "send message to channel" | ||
| puts "Please enter the channel name or Slack ID" | ||
| selection = gets.chomp | ||
| channel = new_workspace.select_channel(selection) |
There was a problem hiding this comment.
What is the purpose of having a select channel and select user option above if we just ask them to select again here?
The design intent was for the person using the CLI to pick a user or channel, then use the same method to send a message to whatever they had selected!
slack.rb
Congratulations! You're submitting your assignment!
You and your partner should collaborate on the answers to these questions.
Comprehension Questions