-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from marcoelho97/develop
Develop
- Loading branch information
Showing
2 changed files
with
80 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,78 @@ | ||
# README | ||
Weather Info App | ||
================ | ||
|
||
This README would normally document whatever steps are necessary to get the | ||
application up and running. | ||
This application retrieves historical weather data for a given location and date range using the Open-Meteo API. If the data is already stored in the database, it will fetch it from there; otherwise, it makes an HTTP request to the Open-Meteo API. | ||
|
||
Things you may want to cover: | ||
Features | ||
-------- | ||
|
||
* Installed gems: | ||
- httparty - Simpler http requests and automatic json parse | ||
* API to fetch historical weather data based on location and date range. | ||
* Uses the Open-Meteo API to retrieve weather information. | ||
* Stores retrieved weather data in the database for faster future access. | ||
|
||
* Ruby version | ||
Prerequisites | ||
------------- | ||
|
||
* System dependencies | ||
Make sure you have the following installed on your system: | ||
|
||
* Configuration | ||
1. **Ruby**: Version 3.x or higher. | ||
2. **Rails**: Version 7.x or higher. | ||
3. **SQLite3** (or another database if configured differently in the project). | ||
4. **Git**: To clone the repository. | ||
|
||
|
||
* Database creation | ||
Setup Instructions | ||
------------------ | ||
|
||
* Database initialization | ||
### 1\. Clone the Repository | ||
|
||
* How to run the test suite | ||
```bash | ||
git clone <This repository url> | ||
cd backend-weather-app-openmeteo | ||
``` | ||
|
||
* Services (job queues, cache servers, search engines, etc.) | ||
### 2\. Install Dependencies | ||
|
||
* Deployment instructions | ||
```bash | ||
bundle install | ||
``` | ||
|
||
* ... | ||
### 3\. Set Up the Database | ||
|
||
```bash | ||
rails db:create | ||
rails db:migrate | ||
``` | ||
|
||
### 4\. Start the Server | ||
Preferably in a different port, as the frontend will be in port 3000. | ||
The frontend is ready to receive from port 10524, so: | ||
|
||
```bash | ||
rails server -p 10524 | ||
``` | ||
|
||
API Endpoints | ||
------------------ | ||
### GET /weather/historical?location=&start_date=&end_date= | ||
Fetch historical weather data for a specific location and date range. | ||
|
||
Response: | ||
```json | ||
[ | ||
{ | ||
"id": Numeric, | ||
"location": String, | ||
"date": Date, | ||
"temperature": Float?, | ||
"precipitation": Float?, | ||
"created_at": Datetime, | ||
"updated_at": Datetime | ||
} | ||
] | ||
``` | ||
|
||
Notes | ||
------------------ | ||
Due to time constraints, additional enhancements (e.g., more robust error handling, more features) didn't come to fruition: | ||
- A route to return a list of locations with the name of the user's input location - To be able to choose the correct one in the frontend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters