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

Stef -- Carets #27

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

Stef -- Carets #27

wants to merge 40 commits into from

Conversation

SesameSeeds
Copy link

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 used a combination of Postman and the console, this particularly came in handy to test to make sure I was pulling the correct information.
Describe your API Wrapper. How did you decide on the methods you created? I kept it simple, by using Postman and knowing I did not (in my mind) need more than two methods I focused on the main methods to list and show. I pulled the information as needed/required from the hashes, focusing on the idea of key, value pair. You can read more about this in my API Wrapper comments, there is a comment for each method with further detail.
Describe an edge case or failure case test you wrote for your API Wrapper. I did not write anything fancy, just one test that returns an empty array if no search word is provided, as well as, a test that returns nil for an invalid uri.
Explain how VCR aids in testing an API. Simply put, particularly in this application where you have a limitation to how many 'hits' you can make... The VCR 'records' your tests and saves them in appropriately labeled cassettes for future testing use which is great in the sense where you can test with the information that is saved and not continually drag down on your API search limit.
What is the Heroku URL of your deployed application? https://trinom.herokuapp.com/

…s, and added recipe file to lib and updated.
…ome page and add search bar across all pages.
@@ -0,0 +1,9 @@
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're missing the VCR setup. You can see that here:

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Sorted that!

@CheezItMan
Copy link

CheezItMan commented Nov 6, 2017

API Muncher

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene Reasonable number of commits, good commit messages.
Comprehension questions Check, well done
General
Rails fundamentals (RESTful routing, use of named paths) Check
Semantic HTML Good semantic HTML.
Errors are reported to the user If the API isn't working no report is given to the user, it's just an empty list of recipes.
API Wrapper to handle the API requests Check
Controller testing Tests are written, but many are erroring out. Now however some are passing.
Lib testing Tests written for your class, but no negative-cases and many don't work.
Search Functionality Works great
List Functionality Works well.
Show individual item functionality (link to original recipe opens in new tab) Check
Styling Looks very nice
Foundation Styling for responsive layout The item layout was responsive
List View shows 10 items at a time/pagination Pagination is working now
The app is styled to create an attractive user interface Very nice styling.
API Features
The App attributes Edaman Check
The VCR casettes do not contain the API key Check!
External Resources
Link to deployed app on Heroku Check, works well
Overall You hit most of the requirements. The major requirement missed was testing. This is something you need to work on with your tutor or find me this week and we'll walk through it. This project was encouraging, but do your best this week and next to get as much done during project time rather than try to catch up on the weekend. Having people nearby who can answer questions will really help.

recipe.ingredients.must_equal "ingredients"
recipe.dietary.must_equal "dietary"
recipe.link.must_equal "link"
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add a test to verify any required fields. Basically a negative test for the initialize method.


group :test do
gem 'minitest-rails'
gem 'minitest-reporters'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also missing VCR and webmock

VCR.use_cassette("recipes") do
good_uri = "https://api.edamam.com/search?r=http://www.edamam.com/ontologies/edamam.owl%23recipe_c23d4d64e02318eef70940c6643353ad"
recipe = EdamamApiWrapper.show_recipe(good_uri)
recipe.label.must_equal 'Pimento Cheese'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No field called label

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a look at things again, you've got some running tests now, but many are throwing errors or failing. Just some cleanup work to do there. I also updated my feedback above.


url = BASE_URL + "r=" + RECIPE_URL + (recipe_uri)

data = HTTParty.get(url)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably need a test to see if data is nil, or data[0] is nil before trying to create a recipe object.

it "Shows a recipe page for a recipe." do
VCR.use_cassette("recipes") do
recipe = "https://api.edamam.com/search?r=http://www.edamam.com/ontologies/edamam.owl%23recipe_c23d4d64e02318eef70940c6643353ad"
get recipe_path(uri: recipe)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be something like this:
get recipe_path(recipe)

But I think the above URI is wrong.

@SesameSeeds
Copy link
Author

Tests now passing completely, with a few more added tests.
Flash messages added and working!
I believe minus adding some OAuth, this looks pretty damn good.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good, now the focus needs to be on VideoStore and crafting an API, and over the weekend reading up on JavaScript

describe EdamamApiWrapper do

describe "self.list_recipes" do
it "Can get recipes with a search word." do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only other thing for this would be verifying that each element of the array is a Recipe. Otherwise really good.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did get our project done for VideoStore and turned it in this afternoon. I'm working on JS now. :) . Thank you for the feedback, I really appreciate it.

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