-
Notifications
You must be signed in to change notification settings - Fork 26
Leaves - Mariya Burrows & Morgan Schuler #21
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
… working on methods for list vs. details & how that interacts with slack.rb
slack.rbWhat We're Looking For
|
| /tmp/ | ||
|
|
||
| # Used by dotenv library to load environment variables. | ||
| # .env |
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 should uncomment this line to include it in your .gitignore file.
|
|
||
| channel_details["slack_id"] = self.slack_id | ||
| channel_details["name"] = self.name | ||
| channel_details["topic"] = self.topic |
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.
the "topic" key provides this hash: {"value"=>"Non-work banter and water cooler conversation", "creator"=>"UMZNG8T8R", "last_set"=>1568061999} It seems that you just want "value" in this case.
| end | ||
|
|
||
| def self.get(url, params) | ||
| return HTTParty.get(url, query: params) |
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.
What is this isn't a success? Make sure you are prepared for something to go wrong and raise a SlackAPIError.
| ["List users", "List channels", "Quit"] | ||
| ) | ||
|
|
||
| # path for list users |
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.
Consider using case/when for this control structure.
| ) | ||
|
|
||
| # user decides how they want to look up recipient | ||
| if search_choice == "1" |
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.
With these nested conditionals, make sure that users always have the option to quit.
| @selected = nil | ||
| end | ||
|
|
||
| def select_user_slack_id(slack_id: nil) |
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.
The following 4 methods are all quite similar. Is there a way to DRY up this code?
| end | ||
|
|
||
| puts "Thank you for using the Ada Slack CLI" | ||
| def print_user_list(list) |
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.
print_user_list and print_channel_list are quite similar. Is there a way to dry up this code?
| end | ||
| end | ||
|
|
||
| it "selects user by slack_id" 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.
What if the recipient you try to select doesn't exist? What happens to a previously selected user if you try to select a bad user? Remember you always need to test for positive and negative results.
| @workspace.select_channel_slack_id(slack_id: "HASFHAS") | ||
| end | ||
|
|
||
| expect{ |
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.
It is not clear from the name of this test why this raises a standard error.
| expect(@channel.details).must_be_kind_of Hash | ||
| end | ||
|
|
||
| it "has a slack_id" 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.
Include tests for the other details.
slack.rb
Congratulations! You're submitting your assignment!
You and your partner should collaborate on the answers to these questions.
Comprehension Questions