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

Val - Edges - API Muncher #29

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

Val - Edges - API Muncher #29

wants to merge 60 commits into from

Conversation

valgidzi
Copy link

@valgidzi valgidzi commented Nov 5, 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? I read the API documentation, then I used Postman to practice formatting the requests and HTTParty in rails console to figure out how to extract the data I needed from the response.
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)? An API wrapper is a Ruby class that sends requests to and handles responses from an API. It's in 'lib' because it doesn't fit the traditional Rails MVC pattern. To interact with an additional API, I would need to create another API wrapper, and store the new access keys or tokens in the .env file and Heroku config vars.
Describe your API wrapper, the methods you created in it, and why you decided to create those methods/how they were helpful My API wrapper has three constants storing request strings and three class methods. Two methods send requests to the Edamam API - .search returns the first 100 results that match the user's search term, and .find_recipe takes an id and returns details for a single recipe. Both methods are called in the RecipesController. The private .create_recipe method handles API response data and creates instances of the Recipe class, which was helpful when writing view code for the responses.
What was an edge case or failure case test you wrote for your API Wrapper? What was a nominal case? I wrote an edge case for .find_recipe 'returns nil for invalid recipe id' , and a nominal case 'returns single recipe when valid id is provided'.
How does VCR aid in testing an API? VCR 'records' API responses in .yml files, so tests can run without sending requests to the API.
What is the Heroku URL of your deployed application? https://munch-ease.herokuapp.com/

@Hamled
Copy link

Hamled commented Nov 14, 2018

API Muncher

What We're Looking For

Feature Feedback
Core Requirements
Git hygiene
Comprehension questions
General
Rails fundamentals (RESTful routing, use of named paths)
Semantic HTML
Errors are reported to the user
API Wrapper to handle the API requests
Controller testing
Lib testing
Search Functionality
List Functionality
Show individual item functionality
Styling
List view shows 10 items at a time and/or has pagination
Attractive and usable UI
API Features
The App attributes Edamam
The VCR cassettes do not contain the API key
External Resources
Link to deployed app on Heroku
Overall Looks great! Very clean implementation of the API wrapper code.

# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
root 'recipes#root'
get '/recipes', to: 'recipes#index', as: 'recipes'
get '/recipe/:id', to: 'recipes#show', as: 'recipe'
Copy link

Choose a reason for hiding this comment

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

To conform with RESTful conventions the path for this route should be /recipes/:id. We could also write this using Rails' resources syntax:

resources :recipes, only: [:index, :show]

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