WeatherVine / back_end

1 stars 0 forks source link

Weather Vine Back End Application!

IMG_0021

About this Project

Weather Vine is an educational app for consumers to connect more deeply with the wine they enjoy. Explore wines from a region and see how the climate has influenced the very wine one drinks!

Table of Contents

Getting Started

To get the web application running, please fork and clone down the repo. git clone <your@github.account:WeatherVine/back_end.git>

Other Repos

Prerequisites

To run this application you will need Ruby 2.5.3 and Rails 5.2.5

Installing

Running the tests

RSpec testing suite is utilized for testing this application.

Service Oriented Architecture

The following is a depiction of the overall service oriented architecture for this application which includes a Rails Front End application, a Rails Engine on the Back End, and two microservices that call out to a World Weather Online's api and Quini Wine's api:

service_oriented_architecture

DB Schema

The following is a depiction of our Database Schema

db_schema

Endpoints

User Dashboard Data

GET https://weathervine-be.herokuapp.com/api/v1/users/:id/dashboard

GET https://weathervine-be.herokuapp.com/api/v1/users/1/dashboard

{
 "data": [
   {
     "id": 1,
     "type": "favorite-wine",
     "attributes": {
       "api_id": "1234",
       "name": "Duckhorn Merlot",
       "comment": "Totes the best."
     }
   },
   {
     "id": 2,
     "type": "favorite-wine",
     "attributes": {
       "api_id": "2345",
       "name": "Barefoot Cabernet Sauvignon",
       "comment": "It’s a'ight."
     }
   },
   {
     "id": 3,
     "type": "favorite-wine",
     "attributes": {
       "api_id": "3456",
       "name": "Yellow Tail Pinot Noir",
       "comment": "OMG"
     }
   }
 ]
}

Wine Search Results Data

GET https://weathervine-be.herokuapp.com/api/v1/wines/search?location=napa&vintage=2018

{
 "data": [
   {
     "id": "5f065fb5fbfd6e17acaad294",
     "type": "wine_search_result",
     "attributes": {
       "api_id": "5f065fb5fbfd6e17acaad294",
       "name": "Duckhorn The Discussion Red 2012",
       "vintage": "2018",
       "location": "Napa Valley"
     }
   },
   {
     "id": "546e64cf4c6458020000000d",
     "type": "wine_search_result",
     "attributes": {
       "api_id": "546e64cf4c6458020000000d",
       "name": "Duckhorn",
       "vintage": "2018",
       "location": "Napa Valley"
     }
   }
 ]
}

Wine Show Page Data

GET https://weathervine-be.herokuapp.com/api/v1/wines/:api_id

GET https://weathervine-be.herokuapp.com/api/v1/wines/546e64cf4c6458020000000d

{
 "data": {
   "id": null,
   "api_id": "546e64cf4c6458020000000d",
   "name": "Duckhorn Sauvignon Blanc",
   "area": "Napa Valley",
   "vintage": "2018",
   "eye": "",
   "nose": "Citrus, Earthy aromas",
   "mouth": "Citrus, Earthy flavours, Fresh acidity, Warm alcohol",
   "finish": "Medium duration, Good quality, Middle peaktime",
   "overall": "Subtle complexity, Pleasant interest, Harmonious balance",
   "temp": "75",
   "precip": "100",
   "start_date": "2017-01-01",
   "end_date": "2017-12-31"
 }
}

Create User Wine Data

POST https://weathervine-be.herokuapp.com/api/v1/users/:user_id/wines

POST https://weathervine-be.herokuapp.com/api/v1/users/1/wines?wine_id=23&user_id=10&comment=this+comment

{
 "data": {
   "id": "#{new user wine id}",
   "type": "user_wine",
   "attributes": {
     "wine_id": "23",
     "user_id": "1",
     "comment": "this comment"
   }
  }
}

Destroy User Wine Data

DELETE https://weathervine-be.herokuapp.com/api/v1/users/:user_id/wines/:user_wine_id

DELETE https://weathervine-be.herokuapp.com/api/v1/users/:user_id/wines/:user_wine_id?user_id=1&wine_id=12


{ "id": "#{user wine id}",
  "wine_id": "12",
  "user_id": "1",
  "comment": "#{user wine comment}",
  "created_at": "#{user wine created at}",
  "updated_at": "#{user wine updated at}"
}

Built With

Versioning

Authors