-
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
Maryam - Api muncher #41
base: master
Are you sure you want to change the base?
Conversation
…e of recipe in consol
API MuncherWhat We're Looking For
|
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html | ||
root to: "recipes#home" | ||
get "/recipes", to: "recipes#index", as: "recipes" | ||
get "/recipes/:uri", to: "recipes#show", as: "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.
Could you use resources
for the index and show pages?
|
||
uri = params[:uri] | ||
@recipe = EdamamApiWrapper.find_recipe(uri) | ||
rescue RecipeNotFoundError |
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.
nice job using rescue!
VCR.use_cassette('recipes') do | ||
get recipes_path | ||
must_respond_with :ok | ||
end |
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.
There are some interesting cases you're not covering here:
- What happens if no search term is provided?
- What if the search returns no results?
It might also be worthwhile to add some tests around the paging parameters:
- What happens if they're absent?
- Do you get different results when they change?
- What if you send a bogus value, like a negative page number?
http_interactions: | ||
- request: | ||
method: get | ||
uri: https://api.edamam.com/search?app_id=<EDAMAM_TOKEN>&app_key=eede0a763580af2ed02e815f7904bbfd&r=http://www.edamam.com/ontologies/edamam.owl%23recipe_test_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.
:( I spy an App Key. :(
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)?