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

Karis - Edges - API-muncher #44

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

Karis - Edges - API-muncher #44

wants to merge 26 commits into from

Conversation

kimj42
Copy link

@kimj42 kimj42 commented Nov 6, 2018

API Muncher

Congratulations! You're submitting your assignment!

Comprehension Questions

Question Answer
How did you go about exploring the Edamam API, and how did you try querying the API? Explored the documentation and played around with postman. Also tried the queries in pry to look at the JSON.
What is an API Wrapper? Why is it in lib? How would your project change if you needed to interact with more than one API (aka more than just the Edamam API)? API wrapper holds the keys and sends the requests to the actual API. It will also send back the response back to the controller. If there was more than one API I guess I would have more than one wrapper and several Keys.
Describe your API wrapper, the methods you created in it, and why you decided to create those methods/how they were helpful The API wrapper returns the all 50 instances of the Recipe class if the search word is valid. It also sends a new request to return the specific instance of the Recipe for the show page. I created those methods to get back the appropriate JSON for the controller. One for index and one for show.
What was an edge case or failure case test you wrote for your API Wrapper? What was a nominal case? An edge case test I wrote is for when the search word is invalid like it's empty or the search word is "asdf". A nominal case was when the word is "cookie".
How does VCR aid in testing an API? VCR prevents sending more API calls.
What is the Heroku URL of your deployed application? https://karis-api-muncher.herokuapp.com/

@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) see inline
Semantic HTML yes
Errors are reported to the user yes - great work!
API Wrapper to handle the API requests yes
Controller testing yes
Lib testing yes - see inline
Search Functionality yes
List Functionality yes
Show individual item functionality yes
Styling
List view shows 10 items at a time and/or has pagination yes
Attractive and usable UI good start
API Features
The App attributes Edamam 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 cassettes do not contain the API key yes
External Resources
Link to deployed app on Heroku yes
Overall Great work overall! The core functionality of this site works well, the code is well tested, and I'm especially happy with your approach to error handling. It is clear to me that the learning goals for this assignment were met. Keep up the hard work!

private

def self.create_recipe(recipe)
unless recipe.nil?

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)

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'

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

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

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?

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