-
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
Karis - Edges - API-muncher #44
base: master
Are you sure you want to change the base?
Conversation
… so it is not showing more pages.
…earch bar to work for index and show page
… working for index and show page
API MuncherWhat We're Looking For
|
private | ||
|
||
def self.create_recipe(recipe) | ||
unless recipe.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.
I like that you've broken this functionality out as separate methods and made them private. Good organization!
data = HTTParty.get(url) | ||
# binding.pry | ||
h = data[0] | ||
return create_recipe(h) |
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 h
?
|
||
get 'recipes', to: 'recipes#index', as: 'recipes_index' | ||
|
||
get 'recipe/:recipe', to: 'recipes#show', as: 'recipe_show' |
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?
describe "create recipe " do | ||
it "does not create an instance of Recipe if recipe is nil" do | ||
VCR.use_cassette("recipes") do | ||
recipe = 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.
Since this is a private method, you don't have to test it! See POODR ch 4.
describe "show recipe" do | ||
it "shows one instance of the recipe for valid recipe id" do | ||
VCR.use_cassette("recipes") do | ||
all_recipes = EdamamApiWrapper.search("cookie") |
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 recipe ID is invalid?
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)?