Skip to content

Conversation

@emilyvomacka
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? We read the documentation via the API endpoints webpage, played around using the tester tab, tried to successfully submit requests via IRB, then moved into coding requests.
Give a short summary of the request/response cycle. Where does your program fit into that scheme? Request response cycle: our program requests info from the API (ex. what are my users?), API responds with data (here are your users!), program parses that data into objects (Users)
How does your program check for and handle errors when using the Slack API? When we receive responses from the API, we check for a code of 200. If not, the user is informed the program didn't load.
Did you need to make any changes to the design work we did in class? If so, what were they? We didn't use .list as a class method; instead, we incorporated them into the Workspace class.
Did you use any of the inheritance idioms we've talked about in class? How? We used super for inheriting variables from Recipient to User and Channel (and had to figure out how to Table_Print those supered variables!).
How does VCR aid in testing a program that uses an API? It lets us run many tests on our code without repeatedly calling the API.


def initialize
@users = SlackCLI::User.json_parse(SlackCLI::User.get(USER_URL, query: GET_PARAMETERS))
@channels = SlackCLI::Channel.json_parse(SlackCLI::Channel.get(CHANNEL_URL, query: GET_PARAMETERS))

Choose a reason for hiding this comment

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

What if these come back with errors? You don't give any useful error messaging so I know what needs to be fixed!

end

def select_user(user_chosen)
selected_user = @users.find { |user| user.slack_id == user_chosen || user.name == user_chosen }

Choose a reason for hiding this comment

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

/Users/devin/Documents/Ada/c12/slack-cli/lib/workspace.rb:58: warning: assigned but unused variable - selected_user

selected_user doesn't actually do anything here.

Choose a reason for hiding this comment

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

If this is a return value, be explicit about that, and don't instantiate a var that won't be used.

attr_accessor :users, :channels, :selected

CHANNEL_URL = 'https://slack.com/api/channels.list'
USER_URL = '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.

I'd put these urls in the respective classes, but that is just me being picky.

@dHelmgren
Copy link

slack.rb

What We're Looking For

Feature Feedback
Core Requirements good
Git hygiene (no slack tokens) good
Comprehension questions good
Functionality
List users/channels yes
Select user/channel yes
Show details yes
Send message yes
Program runs without crashing yes
Implementation
API errors are handled appropriately no, see comments
Inheritance model matches in-class activity yes
Inheritance idioms (abstract class, template methods, polymorphism) used appropriately no abstract class, no template methods
Methods are used to break work down into simpler tasks yes
Class and instance methods are used appropriately yes
Tests written for User functionality yes
Tests written for Channel Functionality yes
Tests written for sending a message yes
Overall Good job overall, this project definitely meets the learning goals of this assignment. I have a few picky comments for you to look over, but keep the hard work up.

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