Skip to content
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

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

Lindseyls
Copy link

@Lindseyls Lindseyls commented May 7, 2018

API Muncher

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
How did you go about exploring the Edamam API, how did you try querying the API? I found the Edaman API website, registered and logged into my account. Then, I requested my API Key and ID and explored the website to look for the correct API Address. Once I found the correct address I used that along with all the API guidelines that Edamam provided to query the API on Postman to find the information that I need for the project.
Describe your API Wrapper. How did you decide on the methods you created? My Recipe API Wrapper has two methods. The first method, #list_recipe will takes in the query or the key search element as the argument and using HTTParty to pull the information from the API URI. Then, the method will loop through the raw_recipe and taken out the information that I want through the lib class recipe.rb. The other method, #show_recipe will take in the recipe's unique uri so that the project show page can display the information just for that one recipe.
Describe an edge case or failure case test you wrote for your API Wrapper. I tested for edge cases when the query is missing a label or uri, also if the input is invalid.
Explain how VCR aids in testing an API. VCR is a tool that allows your tests to record HTTP interactions and replay them when necessary. By re-using these responses, VCR will improve stability and performance of your test suite. Each interaction is recorded as a cassette. We can load cassettes in our tests, depending on which requests/responses we want to be testing.
What is the Heroku URL of your deployed application? https://cookingthyme.herokuapp.com/
Provide a link to the Trello board you used https://trello.com/b/bV769E1n/api-muncher

Lindseyls added 22 commits May 2, 2018 11:37
… 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
@droberts-sea
Copy link

API Muncher

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene yes
Comprehension questions yes
General
Rails fundamentals (RESTful routing, use of named paths) yes - see inline
Semantic HTML yes
Errors are reported to the user yes - excellent work!
API Wrapper to handle the API requests yes
Controller testing yes - good work getting error cases
Lib testing yes
Search Functionality yes
List Functionality yes
Show individual item functionality (link to original recipe opens in new tab) yes
Styling
Responsive layout no
List View shows 10 items at a time/pagination yes
The app is styled to create an attractive user interface yes - looks great!
API Features
The App attributes Edaman no - This is really important! When you're designing code for money, using someone else's work without attribution is a good way to end up in legal trouble.
The VCR casettes do not contain the API key
External Resources
Link to Trello Board yes
Link to deployed app on Heroku yes
Overall Fantastic work overall! Your code is well-organized, well-tested, and quite readable. It's clear that the learning goals for this assignment were met. I've left a few nitpicks inline below, but in general I'm quite happy with this submission. Keep up the hard work!


get '/recipes', to: 'recipes#index', as: 'recipes'
get '/recipes', to: 'recipes#search', as: 'list_recipe'
get '/recipes/:uri', to: 'recipes#show', as: 'show_recipe'

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>

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

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"]

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"
}

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]

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants