diff --git a/feedback.md b/feedback.md index f90b999..795f21f 100644 --- a/feedback.md +++ b/feedback.md @@ -1,8 +1,8 @@ # Feedback Rubric -- Student Being Reviewed: -- Reviewer: -- Classroom: +- Student Being Reviewed: Shonda +- Reviewer: Becca +- Classroom: Space ## Manual App Testing @@ -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.) - yes/no + yes @@ -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.) - yes/no + yes @@ -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. - yes/no + yes - + Nice parallel methods defined in Recipient class to get data and send messages. @@ -51,7 +52,7 @@ - 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. @@ -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.) - yes/no + yes @@ -70,7 +71,7 @@ 6. Practices best practices for testing. (The project has and uses VCR mocking when running tests, and can run offline.) - yes/no + yes @@ -80,7 +81,7 @@ 7. Practices writing tests. (The User, Channel, and Workspace classes have unit tests.) - yes/no + yes @@ -90,7 +91,7 @@ 8. There are also tests for sending messages (the location of these tests may differ, but is likely in Recipient) - yes/no + no @@ -100,7 +101,7 @@ 9. Practices git with at least 15 small commits and meaningful commit messages - yes/no + yes @@ -118,7 +119,8 @@ 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 - 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!" @@ -126,7 +128,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 +136,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 +144,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 + no - did not alert if user was invalid but otherwise looped appropriately diff --git a/individual-reflection.md b/individual-reflection.md index 603cdeb..e60d505 100644 --- a/individual-reflection.md +++ b/individual-reflection.md @@ -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)? - 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 + url = "https://slack.com/api/#{sub_url}?token=#{SLACK_TOKEN}&pretty=1" + response = HTTParty.get(url) + 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 +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 ## 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 @@ -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: