-
Notifications
You must be signed in to change notification settings - Fork 26
Leaves - Dominique and Georgina #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
slack.rbWhat We're Looking For
|
| tp User.list | ||
|
|
||
| elsif option == "list channels" | ||
| tp Channel.list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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