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

Emilce -Muncher (Consuming APIs)-Octos #35

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

Conversation

emilcecarlisa
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 utilized the docs and postman.
Describe your API Wrapper. How did you decide on the methods you created? Class examples
Describe an edge case or failure case test you wrote for your API Wrapper.
Explain how VCR aids in testing an API. They store test data so you're not making the same data calls to an API
What is the Heroku URL of your deployed application? https://emilce-muncher.herokuapp.com/
Provide a link to the Trello board you used https://trello.com/b/6ZtaMj2d/muncher

@droberts-sea
Copy link

API Muncher

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene yes
Comprehension questions some missing
General
Rails fundamentals (RESTful routing, use of named paths) yes
Semantic HTML no
Errors are reported to the user no - when I mangle the recipe URI, I get an exception rather than a polite error message
API Wrapper to handle the API requests yes
Controller testing no
Lib testing missing failure cases, did not test the Recipe class
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 no
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 yes
External Resources
Link to Trello Board yes
Link to deployed app on Heroku yes
Overall

This is a good start, but I think there's a way to go still. You were able to get the core API functionality working, which is good! However, there are some big holes still around error handling, testing and presentation. Remembering how to write "regular" Ruby code is part of the challenge of this assignment, but it seems like you're still struggling some of the Ruby fundamentals.

Many of the problems I'm seeing are things that will hamper the rest of your development process. For example, having a good story around error handling makes everything else easier, because when something goes wrong you get a clear reason why instead of having to hunt for it.

Fortunately, error handling and testing are big components of the VideoStore API project this week - make sure to spend some time focusing on this. These will continue to be important as we move into JavaScript next week, and having them down will make everything else you do a little easier.

I know you've been putting in a ton of effort recently, and I want to acknowledge that. I do see improvements happening and progress being made. Keep up your focus and dedication, and things will continue falling into place.

root 'recipes#search'

get '/recipes', to: 'recipes#index', as: 'recipes'
get '/recipe', to: 'recipes#show', as: 'recipe'

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 this?

<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<title><%= content_for?(:title) ? yield(:title) : "Untitled" %></title>

Choose a reason for hiding this comment

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

This results in the page name being "Untitled"

<body>

<%= yield %>

Choose a reason for hiding this comment

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

You should have something here to help give your site a unified look and feel - maybe a <header> with the search bar, a <footer> with the Edamam logo, and <main> tag wrapped around the yield.

def self.raise_on_error(response)
if response["OK"]
raise EdamamError.new(response["error"])
end

Choose a reason for hiding this comment

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

I like the idea of doing error handling in a method, but this doesn't match the way that Edamam reports errors. The OK and errors keys are what Slack did, but that's not going to be universal.

@to = params[:to].nil? ? @from + MAX_PER_PAGE : params[:to].to_i

@recipes = RecipeApiWrapper.list_recipes(@query, @from, @to)

Choose a reason for hiding this comment

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

If you're expecting your lib file to raise an error, you should wrap this call in a begin/rescue.

describe "list_recipes" do
it "lists recipes based on search" do
VCR.use_cassette("recipes") do
recipes = RecipeApiWrapper.list_recipes("ice cream")

Choose a reason for hiding this comment

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

What if a search yields no results?

it "returns the details for a specific recipe" do
VCR.use_cassette("recipes") do
search = "ice cream"
response = RecipeApiWrapper.get_details("http://www.edamam.com/ontologies/edamam.owl#recipe_7bf4a371c6884d809682a72808da7dc2")

Choose a reason for hiding this comment

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

What if you try to get details with a bogus URI?


describe RecipesControllerController do
# it "must be a real test" do
# flunk "Need real tests"

Choose a reason for hiding this comment

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

You need some controller tests! Here is my list of what I'm looking for:

Index:

  • Valid search term
  • Search term that produces no results (e.g. adfohdaglhjalj)
  • No search term

Show:

  • Valid URI
  • Bogus URI
  • No URI

Root

  • Does it work at all (only one test)

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