diff --git a/feedback.md b/feedback.md
index f90b999..0b98576 100644
--- a/feedback.md
+++ b/feedback.md
@@ -17,16 +17,16 @@
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.)
- yes/no
+ yes
|
|
- 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.)
+ 1. 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.)
|
- yes/no
+ no - missing for posting message
|
@@ -35,13 +35,13 @@
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.
- yes/no
+ yes
|
- 4. Practices clean code.
+ 1. Practices clean code.
- lib/slack.rb only interacts with Workspace (to show a separation of responsibilities).
@@ -51,7 +51,7 @@
|
- yes/no
+ yes - Though it looks like the details method is in user/channel
|
@@ -60,37 +60,37 @@
5. Practices instance methods vs. class methods appropriately. (The methods to list all Channels or Users is a class method within those respective classes.)
- yes/no
+ yes
|
|
- 6. Practices best practices for testing. (The project has and uses VCR mocking when running tests, and can run offline.)
+ 1. Practices best practices for testing. (The project has and uses VCR mocking when running tests, and can run offline.)
|
- yes/no
+ yes
|
|
- 7. Practices writing tests. (The User, Channel, and Workspace classes have unit tests.)
+ 1. Practices writing tests. (The User, Channel, and Workspace classes have unit tests.)
|
- yes/no
+ yes
|
|
- 8. There are also tests for sending messages (the location of these tests may differ, but is likely in Recipient)
+ 1. There are also tests for sending messages (the location of these tests may differ, but is likely in Recipient)
|
- yes/no
+ yes there is one
|
@@ -100,7 +100,7 @@
9. Practices git with at least 15 small commits and meaningful commit messages
- yes/no
+ yes
|
@@ -118,7 +118,7 @@
1. As a user of the CLI program, I can list users and channels with the commands list users and list channels
|
- yes/no
+ yes
|
@@ -126,7 +126,7 @@
2. As a user of the CLI program, I can select users and channels with the commands select user and select channel
|
- yes/no
+ yes
|
@@ -134,7 +134,7 @@
3. As a user of the CLI program, I can show the details of a selected user or channel with the command details
|
- yes/no
+ yes
|
@@ -142,7 +142,7 @@
4. As a user of the CLI program, when I input something inappropriately, the program runs without crashing. Example commands to try are do_something, or select user followed by Mr. Fakename
|
- yes/no
+ yes
|
diff --git a/individual-reflection.md b/individual-reflection.md
index 603cdeb..b0459b5 100644
--- a/individual-reflection.md
+++ b/individual-reflection.md
@@ -9,48 +9,80 @@ 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
- - Answer:
+ - Answer: One GET request that my project makes is a request to the "https://slack.com/api/channels.list" endpoint. This will return a list of all of the channels in the Slack workspace.
1. What is the verb of this request?
- - Answer:
+ - Answer: The verb of this request is GET.
1. What is the path (or the URL, or endpoint) of this request?
- - Answer:
+ - Answer: The endpoint of this request is https://slack.com/api/channels.list.
1. What are the query params (the additional data sent with the request, besides the verb and the path)?
- - Answer:
+ - Answer: The only query param for this request is the Slack Token.
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
+ # the self.get method in my Recipient class (the parent class of Channel)
+ def self.get(url,params)
+ response = HTTParty.get(url,query: params)
+
+ raise ArgumentError.new("Not a valid get request") if response["ok"] != true
+
+ return response
+ end
+
+ # calling the self.get method from my Channel class:
+ def self.list_all
+ url = "https://slack.com/api/channels.list"
+ params = {
+ token: ENV['SLACK_TOKEN'],
+ }
+ response = self.get(url,params)
+ array_of_channels = []
+ response["channels"].each do |channel|
+ array_of_channels.push(Channel.new(slack_id: channel["id"], name: channel["name"], topic: channel["topic"]["value"], member_count: channel["members"].length))
+ end
+
+ return array_of_channels
+ end
```
1. What does the program do if the response comes back with a status code of 200?
- - Answer:
+ - Answer: Because the Slack API is a bit different, my program raises an ArgumentError if "ok" in the response is not true.
1. What does the program do if the response does not come back with a status code of 200?
- - Answer:
+ - Answer: If the response is valid, my program returns the response.
### `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:
+ - Answer: My project makes a POST request in order to send messages.
1. What is the verb of this request?
- - Answer:
+ - Answer: The verb of this request is POST.
1. What is the path (or the URL, or endpoint) of this request?
- - Answer:
+ - Answer: The endpoint of this request is https://slack.com/api/chat.postMessage.
1. What are the query params (the additional data sent with the request, besides the verb and the path)?
- - Answer:
+ - Answer: the parameters sent with this request are token, text, and channel.
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
+ def send_message(message)
+ url = "https://slack.com/api/chat.postMessage"
+
+ response = HTTParty.post(
+ url,
+ body: {
+ token: ENV['SLACK_TOKEN'],
+ text: message,
+ channel: @slack_id
+ },
+ headers: { 'Content-Type' => 'application/x-www-form-urlencoded' }
+ )
+
+ 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:
+ - Answer: My program does not account for responses that come back with a status code of 200, since my program will only allow the user to select a valid user or channel.
1. What does the program do if the response does not come back with a status code of 200?
- - Answer:
+ - Answer: My program will send a message to the selected channel or user.
## Request & Response Cycle
@@ -62,11 +94,11 @@ There are two actors:
Based on the project requirements, when Grace enters "list channels,"
1. What is the request being made in the program?
- - Answer:
+ - Answer: A GET Request to the Slack API to list the channels.
1. Who is the client?
- - Answer:
+ - Answer: The program.
1. Who is the server?
- - Answer:
+ - Answer: The Slack API.
## Part 2: Optional Refactoring