-
Notifications
You must be signed in to change notification settings - Fork 27
Ports - Jillianne & Laneia #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
slack.rbWhat We're Looking For
|
| puts "No details to show, please select a channel or user." | ||
| else | ||
| if user.nil? | ||
| recipient.details(channel["id"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your recipient class doesn't have an instance method called details. You made a class method instead.
| require 'awesome_print' | ||
| require 'dotenv' | ||
| Dotenv.load | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your Channel class here is just a collection of class methods. It would be better if you had a class to represent a channel with instance variables etc. The get_channels method could then return an array of channel instances. That would also allow you to have an instance method to send messages, or get details.
|
|
||
| def self.list_channels(channels) | ||
| channels.each do |channel| | ||
| puts "Channel name: #{channel["name"]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are also mixing the presentation parts of the program with your business logic. It's advisable to put the parts that deal with data and application logic separate from code that presents an interface to the user.
| @is_user = is_user | ||
| end | ||
|
|
||
| def self.details(slack_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method would make more sense as an instance method where you could get the details of that specific instance of Recipient.
| require "dotenv" | ||
| Dotenv.load | ||
|
|
||
| class Recipient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll notice the code for this class is pretty repetitive. That's a clear sign that you can refactor this method to simplify the logic a bit.
Check out the instructor reference design and ask me questions if you have them.
| puts "f. send message" | ||
| puts "g. quit\n\n" | ||
|
|
||
| ap "What would you like to do?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW thank you for letting me select a letter for an option rather than typing out the entire "list users" etc.
| require 'dotenv' | ||
| Dotenv.load | ||
|
|
||
| class User |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class has a lot of the same issues Channel has.
slack.rb
Congratulations! You're submitting your assignment!
You and your partner should collaborate on the answers to these questions.
Comprehension Questions