Skip to content
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

Sockets - Carla && Shubha #2

Open
wants to merge 54 commits into
base: master
Choose a base branch
from

Conversation

shubha-rajan
Copy link

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? Going through the API during the class project definitely helped us figure out how to approach this project. We learned a lot how to read through the documentation and how to find the endpoint and parameters.
Give a short summary of the request/response cycle. Where does your program fit into that scheme? Our program acts as the client for making requests and posting to the API, so it shows the full circle in the request/response cycle.
How does your program check for and handle errors when using the Slack API? Our tests check for status messages and handle errors for invalid data.
Did you need to make any changes to the design work we did in class? If so, what were they? The first one was changing the name of one the methods from .list to .get_from_api, because this seemed more descriptive. We also wrapped everything inside a module, for namespacing purposes.
Did you use any of the inheritance idioms we've talked about in class? How? Yes, we used template methods in our recipient class, which was an abstract class, as the design suggested. We also used polymorphisms since both channel and user respond to name and slack_id.
How does VCR aid in testing a program that uses an API? It makes testing independent of external factors and limits calls to APIs, reducing project cost.

shubha-rajan and others added 30 commits March 18, 2019 17:26
@droberts-sea
Copy link

slack.rb

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene (no slack tokens) yes
Comprehension questions
Functionality
List users/channels yes
Select user/channel yes
Show details yes
Send message yes
Program runs without crashing If you try to select a user/channel that doesn't exist, the program crashes! How would you need to change your tests to catch this?
Implementation
API errors are handled appropriately no - using a bad access token results in a crash (this is a little harder to test for, but it can be done)
Inheritance model matches in-class activity yes
Inheritance idioms (abstract class, template methods, polymorphism) used appropriately yes
Methods are used to break work down into simpler tasks yes
Class and instance methods are used appropriately yes
Overall Good work overall! This program is well-written, well-organized and for the most part well-tested. Keep up the hard work!

def select_channel(name_or_id)
@selected = channels.find { |channel| channel.name == name_or_id }
@selected ||= channels.find { |channel| channel.slack_id == name_or_id }
return @selected

Choose a reason for hiding this comment

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

Good use of ||= here.

it "selects a channel by name" do
channel = @new_workspace.channels.first
name = @new_workspace.channels.first.name
expect(@new_workspace.select_channel(name)).must_equal channel

Choose a reason for hiding this comment

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

What if you try to select a user/channel that does not exist?

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.

3 participants