Conversation
slack.rbWhat We're Looking For
|
| require "pry" | ||
| Dotenv.load | ||
|
|
||
| class Channel |
There was a problem hiding this comment.
This class is just one class method. Instead I suggest having a Channel class with instance variables and methods. Your list method could then return an array of Channel instances.
| @@ -0,0 +1,62 @@ | |||
| require "httparty" | |||
There was a problem hiding this comment.
Looks like you got started on this but didn't get finished. I suggest removing it from git.
|
|
||
| #### TODO: CHANGE VARIABLE NAME | ||
| practice = [] | ||
| User.list.each do |user_name_list| |
There was a problem hiding this comment.
Here you end up making the same API call multiple times, this is inefficient. It might be much more useful to have list create an array of User instances with usernames, ids etc.
| end | ||
| end | ||
|
|
||
| test_workspace = Workspace.new |
There was a problem hiding this comment.
Why do you create a Workspace in this Recipient class.
| end | ||
|
|
||
| test_workspace = Workspace.new | ||
| if channel_name.include?(user) |
There was a problem hiding this comment.
This if-elsif block is a little awkward and could be made much cleaner with duck typing for the User and Channel classes.
| class SlackApiError < StandardError; end | ||
|
|
||
| def select_channel(selected) | ||
| selected |
There was a problem hiding this comment.
What is the purpose of this method? It takes an argument and just returns the argument?
| puts "4. Select Channel" | ||
| puts "5. Quit" | ||
|
|
||
| selection = gets.chomp |
There was a problem hiding this comment.
If this file isn't in your submission, please don't include it in the PR.
| VCR.use_cassette("slack_channels") do | ||
| Channel.new | ||
|
|
||
| expect(Channel.list[0][0]).must_equal "everyone" |
There was a problem hiding this comment.
You can't always assume that the API will always return things in the same order. I would probably write the test to check to see if the array includes "everyone" instead.
| end | ||
| end | ||
|
|
||
| it "will raise an error if given an empty message" do |
|
|
||
| it "lists correct username" do | ||
| VCR.use_cassette("slack_users") do | ||
| User.new |
There was a problem hiding this comment.
Since you are using class methods you don't need to make an instance of User.
slack.rb
Congratulations! You're submitting your assignment!
You and your partner should collaborate on the answers to these questions.
Comprehension Questions