Welcome to WeatherTogether, the captivating game app that brings the world's weather to your fingertips! Each day, users are presented with a set of real-time weather data from a randomly selected location across the globe. Through an engaging interactive map interface, players must use their intuition to guess where this weather snapshot was taken.
But the excitement doesn't end there. WeatherTogether offers a seamless experience with features like tracking previous guesses and monitoring progress on a dynamic leaderboard. For those craving a challenge, dive into Competitive mode where you can test your skills with trickier locations. Alternatively, create a Private Game and invite your closest friends for a personalized and fun-filled experience.
Join us in exploring the world, one weather forecast at a time, with WeatherTogether!
The goal of this app is to provide public education and increase awareness of general global climate trends in a fun and interactive manner.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
To get a local copy up and running follow these simple example steps.
-
Get a free Weather API Key at https://www.weatherapi.com/
-
Clone the repo
git clone https://github.com/Weather-Together/weather_together_be_cap.git
-
Enter your API Terminal
EDITOR="code --wait" rails credentials:edit
In editor pop up
weather_api: key: <YOUR API KEY>
-
Gem Bundle
bundle
-
Rake
rails db:{drop,create,migrate,seed}
This portion of the app handles the backend functionality of the game:
- Creates new user from input recieved from frontend and creates mailer with token to be passed to frontend for account activation.
- Consumes external weather API and configured into proper format to be consumed by frontend portion of the application
- Chron job for rake task to consume API at regular intervals.
- Performs calculations for results and leaderboard then configures in format to be useable by the frontend.
- Database Schema
- New User Creation, Mailbox
- Generate Token
- Generate Verification Email to be Used by Frontend
- Cron Job and Rake Task
- API Consumption
- Weather Data
- Endpoints to be Consumed by Frontend
- Statistics
- Game Results (r^2)
- Daily Leaderboard
- Addition of Private Games
- Action Cable
See the open issues for a full list of proposed features (and known issues).
- GET /up
- Controller: Rails::HealthController#show (named route: rails_health_check)
- Example Request:
curl -X GET https://weather-together-be.onrender.com/up
- Example Response:
<!DOCTYPE html> <html> <body style="background-color: green"></body> </html>
- GET /api/v0/rounds/recent_rounds
- Controller: Api::V0::RoundsController#recent_rounds
- Example Request:
curl -X GET https://weather-together-be.onrender.com/api/v0/rounds/recent_rounds
- Example Response:
{ "data": [ { "id": "92", "type": "round", "attributes": { "close_date": "2024-01-13", "number_of_votes": 12, "target_weather_stats": "{\"location\":{\"name\":\"Ialibu\",\"region\":\"Southern Highlands\",\"country\":\"Papua New Guinea\",\"lat\":-6.32,\"lon\":143.96,\"tz_id\":\"Pacific/Port_Moresby\",\"localtime_epoch\":1705081061,\"localtime\":\"2024-01-13 3:37\"},\"weather_data\":{\"maxtemp_c\":19.4,\"maxtemp_f\":66.9,\"mintemp_c\":10.6,\"mintemp_f\":51.1,\"avgtemp_c\":13.9,\"avgtemp_f\":57.1,\"maxwind_mph\":3.1,\"maxwind_kph\":5.0,\"totalprecip_mm\":23.06,\"totalprecip_in\":0.91,\"totalsnow_cm\":0.0,\"avgvis_km\":6.6,\"avgvis_miles\":4.0,\"avghumidity\":95,\"daily_will_it_rain\":1,\"daily_chance_of_rain\":100,\"daily_will_it_snow\":0,\"daily_chance_of_snow\":0,\"condition\":{\"text\":\"Light rain shower\",\"icon\":\"//cdn.weatherapi.com/weather/64x64/day/353.png\",\"code\":1240},\"uv\":7.0}}", "status": "open", "game_id": 18, "votes": [ { "vote_id": 900, "user_id": 222, "round_id": 92, "status": "unprocessed", "target_weather_stats": "{\"location\":{\"name\":\"Ialibu\",\"region\":\"Southern Highlands\",\"country\":\"Papua New Guinea\",\"lat\":-6.32,\"lon\":143.96,\"tz_id\":\"Pacific/Port_Moresby\",\"localtime_epoch\":1705081061,\"localtime\":\"2024-01-13 3:37\"},\"weather_data\":{\"maxtemp_c\":19.4,\"maxtemp_f\":66.9,\"mintemp_c\":10.6,\"mintemp_f\":51.1,\"avgtemp_c\":13.9,\"avgtemp_f\":57.1,\"maxwind_mph\":3.1,\"maxwind_kph\":5.0,\"totalprecip_mm\":23.06,\"totalprecip_in\":0.91,\"totalsnow_cm\":0.0,\"avgvis_km\":6.6,\"avgvis_miles\":4.0,\"avghumidity\":95,\"daily_will_it_rain\":1,\"daily_chance_of_rain\":100,\"daily_will_it_snow\":0,\"daily_chance_of_snow\":0,\"condition\":{\"text\":\"Light rain shower\",\"icon\":\"//cdn.weatherapi.com/weather/64x64/day/353.png\",\"code\":1240},\"uv\":7.0}}", "latitude": "12.745354201417783", "longitude": "15.68749978648961", "weather_stats": null, "score": null } ] } }] }
- GET /api/v0/rounds/current_community_round
- Controller: Api::V0::RoundsController#current_community_round
- Example Request:
curl -X GET https://weather-together-be.onrender.com/api/v0/rounds/current_community_round
- Example Response:
{ "data": { "id": "92", "type": "round", "attributes": { "close_date": "2024-01-13", "number_of_votes": 12, "target_weather_stats": "{\"location\":{\"name\":\"Ialibu\",\"region\":\"Southern Highlands\",\"country\":\"Papua New Guinea\",\"lat\":-6.32,\"lon\":143.96,\"tz_id\":\"Pacific/Port_Moresby\",\"localtime_epoch\":1705081061,\"localtime\":\"2024-01-13 3:37\"},\"weather_data\":{\"maxtemp_c\":19.4,\"maxtemp_f\":66.9,\"mintemp_c\":10.6,\"mintemp_f\":51.1,\"avgtemp_c\":13.9,\"avgtemp_f\":57.1,\"maxwind_mph\":3.1,\"maxwind_kph\":5.0,\"totalprecip_mm\":23.06,\"totalprecip_in\":0.91,\"totalsnow_cm\":0.0,\"avgvis_km\":6.6,\"avgvis_miles\":4.0,\"avghumidity\":95,\"daily_will_it_rain\":1,\"daily_chance_of_rain\":100,\"daily_will_it_snow\":0,\"daily_chance_of_snow\":0,\"condition\":{\"text\":\"Light rain shower\",\"icon\":\"//cdn.weatherapi.com/weather/64x64/day/353.png\",\"code\":1240},\"uv\":7.0}}", "status": "open", "game_id": 18, "votes": [ { "vote_id": 900, "user_id": 222, "round_id": 92, "status": "unprocessed", "target_weather_stats": "{\"location\":{\"name\":\"Ialibu\",\"region\":\"Southern Highlands\",\"country\":\"Papua New Guinea\",\"lat\":-6.32,\"lon\":143.96,\"tz_id\":\"Pacific/Port_Moresby\",\"localtime_epoch\":1705081061,\"localtime\":\"2024-01-13 3:37\"},\"weather_data\":{\"maxtemp_c\":19.4,\"maxtemp_f\":66.9,\"mintemp_c\":10.6,\"mintemp_f\":51.1,\"avgtemp_c\":13.9,\"avgtemp_f\":57.1,\"maxwind_mph\":3.1,\"maxwind_kph\":5.0,\"totalprecip_mm\":23.06,\"totalprecip_in\":0.91,\"totalsnow_cm\":0.0,\"avgvis_km\":6.6,\"avgvis_miles\":4.0,\"avghumidity\":95,\"daily_will_it_rain\":1,\"daily_chance_of_rain\":100,\"daily_will_it_snow\":0,\"daily_chance_of_snow\":0,\"condition\":{\"text\":\"Light rain shower\",\"icon\":\"//cdn.weatherapi.com/weather/64x64/day/353.png\",\"code\":1240},\"uv\":7.0}}", "latitude": "12.745354201417783", "longitude": "15.68749978648961", "weather_stats": null, "score": null }, ... ] } }] }
- GET /api/v0/rounds/:id/votes
- Controller: Api::V0::Rounds::VotesController#index
- Example Request:
curl -X GET https://weather-together-be.onrender.com/api/v0/rounds/1/votes
- Example Response:
{ "data": [ { "id": "900", "type": "vote", "attributes": { "target_weather_stats": "{\"location\":{\"name\":\"Ialibu\",\"region\":\"Southern Highlands\",\"country\":\"Papua New Guinea\",\"lat\":-6.32,\"lon\":143.96,\"tz_id\":\"Pacific/Port_Moresby\",\"localtime_epoch\":1705081061,\"localtime\":\"2024-01-13 3:37\"},\"weather_data\":{\"maxtemp_c\":19.4,\"maxtemp_f\":66.9,\"mintemp_c\":10.6,\"mintemp_f\":51.1,\"avgtemp_c\":13.9,\"avgtemp_f\":57.1,\"maxwind_mph\":3.1,\"maxwind_kph\":5.0,\"totalprecip_mm\":23.06,\"totalprecip_in\":0.91,\"totalsnow_cm\":0.0,\"avgvis_km\":6.6,\"avgvis_miles\":4.0,\"avghumidity\":95,\"daily_will_it_rain\":1,\"daily_chance_of_rain\":100,\"daily_will_it_snow\":0,\"daily_chance_of_snow\":0,\"condition\":{\"text\":\"Light rain shower\",\"icon\":\"//cdn.weatherapi.com/weather/64x64/day/353.png\",\"code\":1240},\"uv\":7.0}}", "lat": "12.745354201417783", "lon": "15.68749978648961", "weather_stats": null, "score": null, "status": "unprocessed", "round_id": 92, "user_id": 222, "username": "HelpfulPug" } } ] }
- POST /api/v0/users/:user_id/rounds/:round_id/votes/new
- Controller: Api::V0::Rounds::VotesController#create
- Example Request:
curl -X POST https://weather-together-be.onrender.com/api/v0/users/221/rounds/92/votes/new -d '"lat": 46.8, "lon": 10.3'
- Example Response:
{ "data": { "id": "901", "type": "vote", "attributes": { "target_weather_stats": "{\"location\":{\"name\":\"Ialibu\",\"region\":\"Southern Highlands\",\"country\":\"Papua New Guinea\",\"lat\":-6.32,\"lon\":143.96,\"tz_id\":\"Pacific/Port_Moresby\",\"localtime_epoch\":1705081061,\"localtime\":\"2024-01-13 3:37\"},\"weather_data\":{\"maxtemp_c\":19.4,\"maxtemp_f\":66.9,\"mintemp_c\":10.6,\"mintemp_f\":51.1,\"avgtemp_c\":13.9,\"avgtemp_f\":57.1,\"maxwind_mph\":3.1,\"maxwind_kph\":5.0,\"totalprecip_mm\":23.06,\"totalprecip_in\":0.91,\"totalsnow_cm\":0.0,\"avgvis_km\":6.6,\"avgvis_miles\":4.0,\"avghumidity\":95,\"daily_will_it_rain\":1,\"daily_chance_of_rain\":100,\"daily_will_it_snow\":0,\"daily_chance_of_snow\":0,\"condition\":{\"text\":\"Light rain shower\",\"icon\":\"//cdn.weatherapi.com/weather/64x64/day/353.png\",\"code\":1240},\"uv\":7.0}}", "lat": "46.8", "lon": "10.3", "weather_stats": null, "score": null, "status": "unprocessed", "round_id": 92, "user_id": 221, "username": "OutstandingMammoth" } } }
Additional Endpoints Found Here In JSON Contract
Organization: WeatherTogether - [email protected]
Organization Link: https://github.com/Weather-Together
Project Link: https://github.com/Weather-Together/weather_together_be_cap
Blaine Kennedy
Edward Rodriguez
John O'Leary
Kevin Zolman
Michael Kuhlmeier
Sam Tran
Tommy Takahashi