Skip to content

Conversation

@njch5
Copy link

@njch5 njch5 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 thoroughly went through all 3 documentations to see what a successful/failed response looks like, and to get a full understanding what was required in order to use the GET and POST requests. With this project, we also gained an understanding of how to read an API documentation and what arguments each method must have.
Give a short summary of the request/response cycle. Where does your program fit into that scheme? A client sends a request, server receives and processes the request, and sends back a response. Our program acts as the client that sends a request to the API, and the API sends back a response back to our program.
How does your program check for and handle errors when using the Slack API? We created a customer error class called SlackApiError which inherits from the StandardError class. This custom error is raised when the user gives an invalid user or channel in the command loop.
Did you need to make any changes to the design work we did in class? If so, what were they? We did not make any significant design changes. Our program was identical to the UML diagram that was shown in class.
Did you use any of the inheritance idioms we've talked about in class? How? The Recipient class acted as an abstract class which then becomes the super class to User and Channel. We also had template methods called self.list and details which were implemented in both the User and Channel classes. Both User and Channel used polymorphism as they used the same methods but are different objects.
How does VCR aid in testing a program that uses an API? It allows us to call the API once and record that data in a cassette which would then be reused multiple times in testing without calling the API again.

@beccaelenzil
Copy link

slack.rb

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene (no slack tokens) check
Comprehension questions check
Functionality
List users/channels check
Select user/channel check
Show details check
Send message check
Program runs without crashing check
Implementation
API errors are handled appropriately check
Inheritance model matches in-class activity check
Inheritance idioms (abstract class, template methods, polymorphism) used appropriately check
Methods are used to break work down into simpler tasks check
Class and instance methods are used appropriately check
Tests written for User functionality very thorough
Tests written for Channel Functionality very thorough
Tests written for sending a message very thorough
Overall Excellent job overall. This code is well-written and well-tested. It is clear to me that the learning goals around understanding the request/response cycle, consuming an API, and implementing a design using inheritance from scratch were all met. I've left a few inline comments for you to review below, but in general I'm quite impressed by what I see here. Keep up the hard work!

# Ignore cassette files
/specs/cassettes/

.DS_Store

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.env should be in .gitignore.

@selected = nil
end

def select_channel(identifier)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is very similar to the code for select_user below. Could you DRY this up somehow?

query_parameters = {
token: ENV["SLACK_TOKEN"],
}
response = Channel.get(url, query: query_parameters)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not have the tools yet to test a bad get request in this instance, but it is good to think about and build in functionality to deal with bad requests.

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