-
Notifications
You must be signed in to change notification settings - Fork 47
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
API Muncher - Katrina - Edges #27
base: master
Are you sure you want to change the base?
Conversation
API MuncherWhat We're Looking For
|
if data.first | ||
return [details_recipe(data.first)] | ||
else | ||
return [] |
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.
Why put the result in an array here - the method name find_recipe
implies a single result. Instead I would return the single Recipe
instance by itself, or nil
if not found (similar to the behavior of find_by
).
def self.details_recipe(data) | ||
return Recipe.new( | ||
data["label"], | ||
URI(data["uri"]), |
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 and create_recipe
are doing very similar work - could you consolidate them?
private | ||
|
||
def self.create_recipe(api_params) | ||
return Recipe.new( |
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.
I like that you've broken this out as a separate method and made it private
- good organization.
<section class='header-container'> | ||
|
||
<div class="header-text"> | ||
<a href="<%= root_path %>"><h1>MUNCHER</h1></a> |
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.
Why not make this a <header>
?
API Muncher
Congratulations! You're submitting your assignment!
Comprehension Questions
lib
? How would your project change if you needed to interact with more than one API (aka more than just the Edamam API)?