Table of Contents
Board with your recipe book? Want to step out of your comfort zone and taste something new? This is for you.
Lunch and Learn is an app that will let you find your new favorite recipe by country of origin. After you are done cooking Lunch and Learn will look up some edutainment to watch while you enjoy your new dish.
Sign up and get started!
This is a Ruby on Rails web application that was made for the chrome browser and for use with Google OAuth. You will need the following:
- Google Chrome
- Google account
To get started, follow the link below and register with your Google account. Once you are registered you will be able to:
- Search for recipes by country OR have Lunch and Learn select a country for you
- Play an educational video on that select county.
- Enjoy a photo album of life in that country.
This application was made with the following:1
- ruby 2.7.4
- rails 5.2.8
To install and run on your personal computer you will need to do the following:
-
Get a free API Key for EDAMAM Recipe at https://developer.edamam.com/edamam-recipe-api.
-
Get a free API Key for YouTube at https://developers.google.com/youtube/v3/getting-started.
-
Get a free API Key for Pexels at https://www.pexels.com/api/.
-
Fork and clone the repo to your local machine.
-
Install gems and create database.
$ bundle install $ rails db:{drop,create,migrate} $ bundle exec figaro install
-
Enter your API in the
config/application.yml
file.edam_app_id: <YOUR APP ID HERE> edam_app_key: <YOUR KEY HERE> yt_key: <YOUR KEY HERE> pexels_token: <YOUR TOKEN HERE>
-
Start your rails server in the root directory.
$ rails s
-
Now all you need to do is make a request to one of the endpoints.2 Documentation for all API Endpoints can be found below. OR if you prefer to run the simple front-end for this API service, follow this_link.
GET3
localhost:5001/api/v1/recipes
Get a list of recipes from a random country (if no params are passed) OR by selected country, through params.
Parameters
Name Required Type Description country
no string The country you want to get recipes from.
Response
{ "data": [ { "id": null, "type": "recipe", "attributes": { "title": "Andy Ricker's Naam Cheuam Naam Taan Piip (Palm Sugar Simple Syrup)", "url": "https://www.seriouseats.com/recipes/2013/11/andy-rickers-naam-cheuam-naam-taan-piip-palm-sugar-simple-syrup.html", "country": "Thailand", "image": "https://edamam-product-images.s3.amazonaws.com..." } }, { "id": null, "type": "recipe", "attributes": { "title": "Sriracha", "url": "http://www.jamieoliver.com/recipes/vegetables-recipes/sriracha/", "country": "Thailand", "image": "https://edamam-product-images.s3.amazonaws.com/." } }, {...}, {...}, {...}, {etc}, ] }
localhost:5001/api/v1/learning_resources
Get a list of learning resources from a random country (if no params are passed) OR by selected country, through params.
Parameters
Name Required Type Description country
no string The country you want to get learning resources from.
Response
{ "data": { "id": null, "type": "learning_resource", "attributes": { "country": "Laos", "video": { "title": "A Super Quick History of Laos", "youtube_video_id": "uw8hjVqxMXw" }, "images": [ { "alt_tag": "standing statue and temples landmark during daytime", "url": "https://images.unsplash.com/photo-1528181304800-259b08848526?ixid=MnwzNzg2NzV8MHwxfHNlYXJjaHwxfHx0aGFpbGFuZHxlbnwwfHx8fDE2Njc4Njk1NTA&ixlib=rb-4.0.3" }, { "alt_tag": "five brown wooden boats", "url": "https://images.unsplash.com/photo-1552465011-b4e21bf6e79a?ixid=MnwzNzg2NzV8MHwxfHNlYXJjaHwyfHx0aGFpbGFuZHxlbnwwfHx8fDE2Njc4Njk1NTA&ixlib=rb-4.0.3" }, { "alt_tag": "orange temples during daytime", "url": "https://images.unsplash.com/photo-1563492065599-3520f775eeed?ixid=MnwzNzg2NzV8MHwxfHNlYXJjaHwzfHx0aGFpbGFuZHxlbnwwfHx8fDE2Njc4Njk1NTA&ixlib=rb-4.0.3" }, {...}, {...}, {...}, {etc}, ] } } }
localhost:5001/api/v1/favorites
Get a list of your user's favorite recipes.
Parameters
Name Required Type Description api_key
yes string A unique key created after a successful POST /api/v1/users used to identify user requests
Response
{ "data": [ { "id": "1", "type": "favorite", "attributes": { "recipe_title": "Recipe: Egyptian Tomato Soup", "recipe_link": "http://www.thekitchn.com/recipe-egyptian-tomato-soup-weeknight....", "country": "Egypt", "created_at": "2022-11-02T02:17:54.111Z" } }, { "id": "2", "type": "favorite", "attributes": { "recipe_title": "Crab Fried Rice (Khaao Pad Bpu)", "recipe_link": "https://www.tastingtable.com/.....", "country": "Thailand", "created_at": "2022-11-07T03:44:08.917Z" } } ] }
localhost:5001/api/v1/users
Create a new user.
Parameters (JSON payload in request body)
{ "name": "Athena Dao", "email": "athenadao@bestgirlever.com", "password": "supersecretpassword", "password_confirmation": "supersecretpassword" }
Response
{ "data": { "type": "user", "id": "1", "attributes": { "name": "Athena Dao", "email": "athenadao@bestgirlever.com", "api_key": "jgn983hy48thw9begh98h4539h4" } } }
localhost:5001/api/v1/sessions
Get user info for authentication use on front-end app.
Parameters (JSON payload in request body)
{ "email": "athenadao@bestgirlever.com", "password": "supersecretpassword" }
Response
{ "data": { "type": "user", "id": "1", "attributes": { "name": "Athena Dao", "email": "athenadao@bestgirlever.com", "api_key": "jgn983hy48thw9begh98h4539h4" } } }
localhost:5001/api/v1/favorites
Create a new favorite recipe for the select user.
Parameters (JSON payload in request body)
{ "api_key": "jgn983hy48thw9begh98h4539h4", "country": "Thailand", "recipe_link": "https://www.tastingtable.com/.....", "recipe_title": "Crab Fried Rice (Khaao Pad Bpu)" }
Response
{ "success": "Favorite added successfully" }
localhost:5001/api/v1/favorites
Delete a selected favorite recipe for the select user.
Parameters (JSON payload in request body)
{ "api_key": "jgn983hy48thw9begh98h4539h4", "country": "Thailand", "recipe_link": "https://www.tastingtable.com/.....", "recipe_title": "Crab Fried Rice (Khaao Pad Bpu)" }
Response
{ "success": "Favorite removed successfully" }
Back-end Main Goal(s)
- GET
/recipes
Endpoint - GET
/learning_resources
Endpoint - POST
/users
Endpoint - POST
/sessions
Endpoint - POST
/favorites
Endpoint - GET
/favorites
Endpoint - DELETE
/favorites
Endpoint
Back-end Stretch Goals
- Add prams check and error handeling
- Implement basic authentication with bcrypt
- Utilize Cashing OR Background Workers
Front and Back-end Super Stretch Goals
- Update docs with Swagger
- Move authentication from Bcrypt to Google OAuth
- Deploy to Heroku
See the open issues for a full list of proposed features (and known issues).
- Expose an API that aggregates data from multiple external APIs
- Expose an API that requires and authentication token
- Expose an API for CRUD functionality
- Determine completion criteria based on the needs of other developers
- Test both API consumption and exposure, making use of at least one mocking tool (VCR, Webmock)
-
Technical Presentation
- Demo understanding of learning goals
- Demo functionality with Postman and live demo
- Discuss technical quality & organization of code
- Discuss test coverage, happy path, sad path, and edge cases
-
Feature Delivery
- Complete all MVP features (Roadmap: Main Goals) as directed here
- Complete 3 of 4 stretch goals
-
Technical Quality
- Demonstrate good use of abstraction and encapsulation in Facades and Services
- Demonstrate good use of Model, View, Controller (MVC) design principles
-
Testing
- Minimum of 90% testing coverage
- Include all 'happy path' and 'sad path' testing
- Include use of VCR and/or Webmock
- Testing checks for presence of data in payload and data type
Lunch and Learn is a Ruby on Rails web application hosted on Heroku.
Do you have a better & cooler way of doing what we did? Your contribution would be greatly appreciated.
Please fork the repo, create your branch, and create a pull request. You can also simply open an issue with the tag "enhancement".
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Thanks again!
- Turing School of Software Design: https://turing.edu/
- DBdiagram.io: https://dbdiagram.io/home
- Best-README-Template: https://github.com/othneildrew/Best-README-Template
- API-endpoints: https://github.com/bufferapp/README/blob/master/billing/api-endpoints.md
Distributed under the MIT License.
Footnotes
-
Note: Information on installing Ruby 2.7.4 and Rails 5.2.8 can be found here ↩
-
Note: The port is crrrently set to 5001. To change the port #, go to
config/puma.rb
and enter your desired port #:port ENV.fetch("PORT") { <YOUR NUMBER HERE> }
. You can also elect to un-comment the Background Workers Job CleanDbJob (favorites_controller: line 40). Before you do this, you will need to set up a Redis server and Sidekiq adapter. Instructions to this can be found here. Troubleshooting Redis and Mac M1 issues can be found here. ↩ -
Note: The
:country
section in the JSON Response refers to the search criteria. If no video is found on that country, a video on a related country (by culture or geographic area) will instead be returned. ↩