Skip to content

Conversation

@antoniairizarry
Copy link

Assignment Submission: Slack CLI

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

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? I was pretty behind so I made sure to read up as much as possible on the Slack API documentation page and use the testing feature included in it to know which params were required. Using Postman also gave me a better idea of how things were structured and how I should attempt to access information.
Give a short summary of the request/response cycle. Where does your program fit into that scheme? In a request/response cycle a client sends a request and a server sends back a response. In the Slack CLI project my program sends requests to the Slack API and receives responses. The user is able to take actions like request information or post messages.
How does your program check for and handle errors when using the Slack API? It raises errors if calls fail.
How did the design and organization of your project change over time? It didn't change too much because I used the scaffolding. I did realize, though, that I didn't need as many test files as I thought because the ones needed covered several bases.
Did you use any of the inheritance idioms we've talked about in class? How? Yes, both Channel and User classes inherit from Recipient.
How does VCR aid in testing a program that uses an API? It gives you the capability of running tests without internet access, it also reduces the dependency on an external API and could possibly save costs.

Copy link

@jmaddox19 jmaddox19 left a comment

Choose a reason for hiding this comment

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

Great work! I'm impressed you got as much as you did with such little healthy time to work with!
I do see what you were saying about not having as much time to spend on tests as you would have liked.
I will continue to check-in on your testing as we get into it with JS. I recommend making that an area of focus while working on JS Adagrams so we can identify if there are still any gaps.

Comment on lines +25 to +27
if response.code != 200 || response['ok'] == false
raise SlackAPIError
end

Choose a reason for hiding this comment

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

This honestly is generally pretty sufficient! The one thing I would add is figuring out what part of the response gives a useful message explaining what went wrong and making sure to record that as a property of SlackAPIError.
If it's unclear what I mean by that, please ask!

before do
@user = User.new(slack_id: "USLACKBOT", name: "slackbot", real_name: "Slackbot", status_text: "", status_emoji: "")
end
it "returns user details" do

Choose a reason for hiding this comment

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

This should be one indentation level further.

Comment on lines +20 to +21
end
end

Choose a reason for hiding this comment

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

There's actually a missing end here that I think results in unintentionally nested "describe" blocks. Fixing the indentation on line 18 would make that easier to catch.
I use a VSCode plugin called indent-rainbow that I really like to help me catch things like this. It works for ruby and JS!

@user = User.new(slack_id: "USLACKBOT", name: "slackbot", real_name: "Slackbot", status_text: "", status_emoji: "")
end
it "returns user details" do
expect(@user.details).must_equal "Slack ID: #{@user.slack_id}, Name: #{@user.name}, Real Name: #{@user.real_name}, Status Text: #{@user.status_text}, Status Emoji: #{@user.status_emoji}"

Choose a reason for hiding this comment

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

This should be 2 indentation levels further.


def self.list_all
#get the data
data = self.get("https://slack.com/api/users.list")

Choose a reason for hiding this comment

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

As a general rule, every API call should include some error handling. (There is always going to be the possibility of a network problem, the API url getting changed, etc.)

@jmaddox19
Copy link

jmaddox19 commented Apr 2, 2020

Sorry, I just realized that all the tests are written for you in the JS Adagrams project, so that won't be an opportunity to practice testing.
In fact, even the project after that doesn't require you to write tests. I think we will want to find some way for you to do more practice writing tests soon, so I may need to get more creative in how to do that.

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