Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions feedback.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Feedback Rubric

- Student Being Reviewed:
- Reviewer:
- Classroom:
- Student Being Reviewed: Shonda
- Reviewer: Becca
- Classroom: Space

## Manual App Testing

Expand All @@ -17,7 +17,7 @@
1. Practices best practices working with APIs. (The .env is not checked into git, and no API token was directly used in the Ruby code without ENV.)
</td>
<td>
yes/no
yes
</td>
</tr>

Expand All @@ -26,7 +26,7 @@
2. Practices error handling with APIs. (For all pieces of code that make an API call, it handles API requests that come back with errors/error status codes appropriately.)
</td>
<td>
yes/no
yes
</td>
</tr>

Expand All @@ -35,7 +35,8 @@
3. Implements inheritance and inheritance idioms. There is a Recipient class. User and Channel inherit from Recipient. In Recipient, there are appropriate methods defined that are used in both User and Channel. Some may be implemented. Some may be template methods.
</td>
<td>
yes/no
yes -
Nice parallel methods defined in Recipient class to get data and send messages.
</td>
</tr>

Expand All @@ -51,7 +52,7 @@
</ul>
</td>
<td>
yes/no
yes - Great job using `.find` method with select_channel and select_user methods in workspace.rb - very clean and clear execution. For Slack.rb `main` method, could pull out user-facing gets.chomp pieces into a separate helper method.
</td>
</tr>

Expand All @@ -60,7 +61,7 @@
5. Practices instance methods vs. class methods appropriately. (The methods to list all Channels or Users is a class method within those respective classes.)
</td>
<td>
yes/no
yes
</td>
</tr>

Expand All @@ -70,7 +71,7 @@
6. Practices best practices for testing. (The project has and uses VCR mocking when running tests, and can run offline.)
</td>
<td>
yes/no
yes
</td>
</tr>

Expand All @@ -80,7 +81,7 @@
7. Practices writing tests. (The User, Channel, and Workspace classes have unit tests.)
</td>
<td>
yes/no
yes
</td>
</tr>

Expand All @@ -90,7 +91,7 @@
8. There are also tests for sending messages (the location of these tests may differ, but is likely in Recipient)
</td>
<td>
yes/no
no
</td>
</tr>

Expand All @@ -100,7 +101,7 @@
9. Practices git with at least 15 small commits and meaningful commit messages
</td>
<td>
yes/no
yes
</td>
</tr>
</table>
Expand All @@ -118,31 +119,32 @@
<td>1. As a user of the CLI program, I can <strong>list</strong> users and channels with the commands <code>list users</code> and <code>list channels</code>
</td>
<td>
yes/no
yes - when listing channels, tableprint prints code in the form `"value" => "Company-wide announcements..."` .
When selecting a valid option from the menu, a message is printed out to the user: "This exception will be rescued!"
</td>

</tr>
<tr>
<td>2. As a user of the CLI program, I can <strong>select</strong> users and channels with the commands <code>select user</code> and <code>select channel</code>
</td>
<td>
yes/no
yes
</td>
</tr>

<tr>
<td>3. As a user of the CLI program, I can show the details of a selected user or channel with the command <code>details</code>
</td>
<td>
yes/no
yes
</td>
</tr>

<tr>
<td>4. As a user of the CLI program, when I input something inappropriately, the program runs without crashing. Example commands to try are <code>do_something</code>, or <code>select user</code> followed by <code>Mr. Fakename</code>
</td>
<td>
yes/no
no - did not alert if user was invalid but otherwise looped appropriately
</td>
</tr>
</table>
Expand Down
95 changes: 58 additions & 37 deletions individual-reflection.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,65 +8,86 @@ Answer the following comprehension questions **within this file.** Write your an

### `GET` Request Review

1. Describe a GET request that your project makes, and the high-level description of what it does
1. Describe a GET request that your project makes, and the high-level description of what it does
- Answer: A Get request for my project is requesting that my browser perform an action for example. I created a method that requests a url and sub url to the user list or channel list.
1. What is the verb of this request?
- Answer: GET
1. What is the path (or the URL, or endpoint) of this request?
- Answer: "https://slack.com/api/#{sub_url}?token=#{SLACK_TOKEN}&pretty=1"
1. What are the query params (the additional data sent with the request, besides the verb and the path)?
Copy link

Choose a reason for hiding this comment

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

Do you have an answer here? In this case, it's the token, which holds the value of the Slack API Key/Slack Token!

- Answer:
1. What is the verb of this request?
- Answer:
1. What is the path (or the URL, or endpoint) of this request?
- Answer:
1. What are the query params (the additional data sent with the request, besides the verb and the path)?
- Answer:
1. What is the syntax used to make this request? (Copy and paste a code snippet here)
1. What is the syntax used to make this request? (Copy and paste a code snippet here)

- Answer:
```ruby
# Copy and paste your answer below this comment
```ruby # Copy and paste your answer below this comment
def self.get(sub_url) # self calls only know about its self to call in another method # must call the (Class name).something # Recipent.get(querty) is called on the respective class that
Copy link

Choose a reason for hiding this comment

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

This is a perfect explanation of self/the class method syntax! Nice!

url = "https://slack.com/api/#{sub_url}?token=#{SLACK_TOKEN}&pretty=1"
response = HTTParty.get(url)
Copy link

Choose a reason for hiding this comment

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

This is a perfectly good way to make this HTTP call! You construct the url by interpolating a lot of the important things you need, such as the sub_url and API key.

In case the string interpolation is confusing to read, it's good to know that the API key is being passed in as a query parameter. (One way to tell this by reading it is seeing any URL that has a ? in it, and seeing the different pairs afterwards. In this example, we see token=...)

If you wanted to try an alternative syntax, you may use this syntax with HTTParty:

HTTParty.get("https://slack.com/api/#{sub_url}", query: {token: ENV['SLACK_TOKEN']})

This line is saying "Make a GET request to this url. Also, pass along these query parameters: token, with a value of ENV[SLACK_TOKEN]"

Again, both syntaxes are correct; just wanted to make sure you knew the other option!

return response
end

# Copy and paste your answer above this comment
```
1. What does the program do if the response comes back with a status code of 200?
- Answer:
1. What does the program do if the response does not come back with a status code of 200?
- Answer:
# Copy and paste your answer above this comment

1. What does the program do if the response comes back with a status code of 200?
- Answer: The request will be valid and will return the response
1. What does the program do if the response does not come back with a status code of 200?
- Answer: if the response does not comeback with true or 200 there Slack Error will raise an error

### `POST` Request Review

If your project does not make a POST request, read through Wave 3 on the original Slack CLI, and research and answer questions 1, 2, 3, 4, 6, and 7.

1. Describe a POST request that your project makes, and the high-level description of what it does
- Answer:
1. What is the verb of this request?
- Answer:
1. What is the path (or the URL, or endpoint) of this request?
- Answer:
1. What are the query params (the additional data sent with the request, besides the verb and the path)?
- Answer:
1. What is the syntax used to make this request? (Copy and paste a code snippet here)
1. Describe a POST request that your project makes, and the high-level description of what it does
- Answer: The post will update the data as it is posting to a channel or a user.
1. What is the verb of this request?
- Answer: POST
1. What is the path (or the URL, or endpoint) of this request?
- Answer: url = "https://slack.com/api/chat.postMessage?token=#{SLACK_TOKEN}&channel=#{@slack_id}&text=#{message}"
1. What are the query params (the additional data sent with the request, besides the verb and the path)?
- Answer: token, user/channel or text
1. What is the syntax used to make this request? (Copy and paste a code snippet here)

- Answer:
```ruby
# Copy and paste your answer below this comment

# Copy and paste your answer above this comment
def send_message(message)
url = "https://slack.com/api/chat.postMessage?token=#{SLACK_TOKEN}&channel=#{@slack_id}&text=#{message}"
```
1. What does the program do if the response comes back with a status code of 200?
- Answer:
1. What does the program do if the response does not come back with a status code of 200?
- Answer:

response = HTTParty.post(url)

if response["ok"] != true || response.code != 200
raise SlackError(("There was an error posting this message: #{response["error"]}"))
else puts "Your message has been sent successfully!" end

return response
end

# Copy and paste your answer above this comment
```

1. What does the program do if the response comes back with a status code of 200?
- Answer: if the response is not true or equal to 200
Copy link

Choose a reason for hiding this comment

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

Hm, this answer doesn't quite make sense considering the question.

The program makes a request to send a message... and a response eventually comes back from the server, back to the program. A response always has a status code. In the case that the response has a status code of 200, what does the program do?

This question is asking what happens when the response comes back with a status code of 200. Your answer should be talking about the program's logic of what happens after that! What does a status code of 200 mean?

1. What does the program do if the response does not come back with a status code of 200?
- Answer: Raise a built in response era
Copy link

Choose a reason for hiding this comment

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

Similar to my other comment, I'd love to hear more details about this. What does your program do if the response has a status code that isn't 200? What does "Raise a built in response era" mean in this case?


## Request & Response Cycle

Imagine this situation: A human user, Grace, opens up Terminal and runs in the command line `$ ruby lib/slack.rb`. When the program runs, she types "list channels."

There are two actors:
- the human user, Grace, and their computer that runs `slack.rb`
- Slack API

- the human user, Grace, and their computer that runs `slack.rb`
- Slack API

Based on the project requirements, when Grace enters "list channels,"

1. What is the request being made in the program?
- Answer:
- Answer: we are request a response of a list of channels and assocaited Data
1. Who is the client?
- Answer:
- Answer: Grace is using the her web browser which is the client
1. Who is the server?
- Answer:
- Answer: Slack's API

## Part 2: Optional Refactoring

Expand All @@ -80,4 +101,4 @@ If your reflection inspired you to make minimal changes to your Slack CLI implem

### Describe your optional Slack CLI changes here

Answer:
Answer: