Open
Conversation
… and created the custom lib files
… when I ran test. Updated the footer with powered by Edamam. Also renamed my new.html.erb to homepage.html.erb and defined a method for the homepage inside the controller.
… in the controller and created the params :ingredients. also, working on styling
…ng the recipe on the show page
… index.html.erb page and did some styling
…mation or invalid input
API MuncherWhat We're Looking For
|
|
|
||
| get '/recipes', to: 'recipes#index', as: 'recipes' | ||
| get '/recipes', to: 'recipes#search', as: 'list_recipe' | ||
| get '/recipes/:uri', to: 'recipes#show', as: 'show_recipe' |
There was a problem hiding this comment.
What is the difference between lines 6 and 7?
Could you use resources here?
| </body> | ||
|
|
||
| <footer id="footer"> | ||
| <section> |
There was a problem hiding this comment.
This <footer> (and all rendering content) should be inside the <body> tag.
| rescue RecipeApiWrapper::RecipeError => error | ||
| flash[:status] = :failure | ||
| flash[:message] = "API called failed: invalid input. Please try again." | ||
| redirect_back fallback_location: root_path |
There was a problem hiding this comment.
Good work matching your error handling here in the controller to what's going on in your lib file. It's easy to end up with a disconnect here.
|
|
||
| response = HTTParty.get(full_url) | ||
|
|
||
| raise RecipeError.new("Could not find recipes") unless response["hits"] |
There was a problem hiding this comment.
Good work figuring out what constitutes an error from this API.
| VCR.use_cassette("recipes") do | ||
| get recipes_path, params: { | ||
| ingredient: "chinese food" | ||
| } |
There was a problem hiding this comment.
Does this actually yield no results?
| VCR.use_cassette("recipes") do | ||
| recipe = RecipeApiWrapper.list_recipes("chicken").first | ||
|
|
||
| recipe_id = recipe.uri.split("_")[1] |
There was a problem hiding this comment.
I like that you get the URI straight from the search results here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
API Muncher
Congratulations! You're submitting your assignment!
Comprehension Questions