ajpulzone / lunch_and_learn

Mod 3 Final Solo Project
0 stars 0 forks source link
Deschutes Brewery GIF



Welcome to the Lunch and Learn API Service

This repo was created to provide a front end team access to information to create a website that allows users to find recipes and learning materials based on a country they choose. Or, if the user is feeling whimsical, allowing a random country to be chosen for them.


Table of Contents

Learning Goals

API Key Sign Up Instructions

You will need to sign up for the following API keys in order to use this repo:

Developer Setup

If you would like to demo this API on your local machine:

  1. Ensure you have Ruby 2.7.4 and Rails 5.2.8 installed
  2. Fork and clone down this repo and navigate to the root folder cd lunch_and_learn
  3. Run bundle install
  4. Run bundle exec figaro install
  5. Run rails db:{drop,create,migrate,seed}
  6. In your application.yml file:
    • - assign your Unsplash api key to a variable (this will need to be passed in as query params with key unsplash_api_key)
      - assign your YouTube/Google api key to a variable (this will need to be passed in as query params with key google_api_key)
      - assign your Edamam api key to a variable (this will need to be passed in as query params with key edamam_recipe_api_key)
  7. (Optional) To run the test suite, run bundle exec rspec spec
  8. Run rails s

You should now be able to hit the API endpoints using Postman or a similar tool.

Default host is http://localhost:3000

Tech and Tools

Database Schema

schema

Endpoints

RESTful

  1. Get Recipes for A Specified Country

  2. ``` GET /api/v1/recipes?country=ireland ``` - Example Response: ```json { "data": [ { "id": null, "type": "recipe", "attributes": { "title": "East of Ireland Recipe", "url": "http://www.edamam.com/recipe/east-of-ireland-recipe-6d13b3f170ff1927fae509941714f13a/ireland", "image_url": "https://edamam-product-images.s3.amazonaws.com/web-img/a63/a631e7080e6b18bdea4e4ddab4523984.jpg?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEMr%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIHUYRP7LLtE0VkCKrQcEwMFSMFNLMA2y6XckpR7zspunAiEAgcJTplJpjIg25eC5gNZctQ96PH8OxEPPrSUXf4Y2H6cqzAQIMxAAGgwxODcwMTcxNTA5ODYiDDR5crZtGf3MdnWRxiqpBHXYKNb5uVR%2B7NDptTsi9PmcvoCms6mZ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host&X-Amz-Expires=3600&X-Amz-Credential=ASIASXCYXIIFE436I6PM%2F20230116%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=1be506c07fc64f33b233b6726a7ba66ced069fbaefcf691bde5935fa2625c796", "country": "Ireland" } } ] } ```
  3. Get Learning Resources For a Specified Country

  4. ```GET /api/v1/learning_resources?country=ireland``` - Example Response: ```json { "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}, ] } } } ```
  5. User Registration

  6. ```POST /api/v1/users``` - Example Response: ```json { "data": { "id": "6", "type": "user", "attributes": { "name": "Drake", "email": "imamuppet@gmail.com", "user_api_key": "ec21d9eb6929c7d79427f5be5bc7a16b" } } } ```
  7. Add a Favorite To a User

  8. ```POST /api/v1/favorites``` - Example Response: ```json { "success": "Favorite added successfully" } ```
  9. Get a Users Favorites

  10. ```GET /api/v1/favorites``` - Example Response: ```json { "data": [ { "id": "1", "type": "favorite", "attributes": { "country": "Ireland", "recipe_link": "http://www.edamam.com/recipe/cheddar-colcannon-torte-97c47f3162d83a9da30673929bbf8f7a/ireland", "recipe_title": "Cheddar Colcannon Torte", "created_at": "2023-01-17T04:28:23.879Z" } } ] } ```