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!
To get the web application running, please fork and clone down the repo.
git clone <your@github.account:WeatherVine/back_end.git>
To run this application you will need Ruby 2.5.3 and Rails 5.2.5
Install the gem packages
bundle install
Create the database by running the following command in your terminal
rails db{:drop, :create, :migrate}
RSpec testing suite is utilized for testing this application.
bundle exec rspec
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:
The following is a depiction of our Database Schema
GET https://weathervine-be.herokuapp.com/api/v1/users/:id/dashboard
:id
- valid user id
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" } } ] }
location
vintage
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" } } ] }
GET https://weathervine-be.herokuapp.com/api/v1/wines/:api_id
:api_id
- id used to access wine info from external wine API
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" } }
POST https://weathervine-be.herokuapp.com/api/v1/users/:user_id/wines
Required path params:
wine_id
user_id
Optional path params:
comment
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" } } }
DELETE https://weathervine-be.herokuapp.com/api/v1/users/:user_id/wines/:user_wine_id
wine_id
user_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}" }