Skip to content

Conversation

@geomsb
Copy link

@geomsb geomsb commented Sep 13, 2019

slack.rb

Congratulations! You're submitting your assignment!

You and your partner should collaborate on the answers to these questions.

Comprehension Questions

Question Answer
How did you go about exploring the Slack API? Did you learn anything that would be useful for your next project involving an API? We searched through each of the three endpoints to see arguments that were required to run the get and post commands. Yes, we learned how to get information from the API and post information to API.
Give a short summary of the request/response cycle. Where does your program fit into that scheme? When we call the get method on HTTParty, it asks HTTParty to send a request to the API for information and return a response. When we call the post method on HTTParty, it asks the API to post our requested message.
How does your program check for and handle errors when using the Slack API? We raised a SlackAPIError if there was no message posted.
Did you need to make any changes to the design work we did in class? If so, what were they? No - it was great.
Did you use any of the inheritance idioms we've talked about in class? How? Yes - Recipient was an abstract class and it had two template methods (send_message and self.get).
How does VCR aid in testing a program that uses an API? It saves the request response cycle and uses that recording to run the rest of the tests.

@dHelmgren
Copy link

slack.rb

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene (no slack tokens) great!
Comprehension questions good
Functionality
List users/channels yes
Select user/channel yes
Show details yes
Send message yes
Program runs without crashing only crashes on bad input, see comment
Implementation
API errors are handled appropriately yes
Inheritance model matches in-class activity yes
Inheritance idioms (abstract class, template methods, polymorphism) used appropriately mostly, see comments about selecting users and sending messages!
Methods are used to break work down into simpler tasks yes
Class and instance methods are used appropriately yes
Tests written for User functionality yes
Tests written for Channel Functionality yes
Tests written for sending a message yes
Overall Good! The biggest piece of advice I have is to interrogate why you are building each piece. If you had gone back and looked at the control loop, it might have occurred to you that you were doing 'wasted work' in your select channel and select user. As software developers, we don't want to do the same work twice, and we REALLY don't want to have operations that don't do anything meaningful. If you ever wonder "WHY THE HECK ARE WE DOING THIS!?", please ask! The instructors can often provide clarity!

tp User.list

elsif option == "list channels"
tp Channel.list

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.")

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"

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)

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants