-
Notifications
You must be signed in to change notification settings - Fork 44
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
Luxi Lindsey - API-Muncher - Octos #21
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that you get the URI straight from the search results here.
API Muncher
Congratulations! You're submitting your assignment!
Comprehension Questions