The Weather App is a Ruby on Rails application that fetches weather data based on a ZIP code. It utilizes caching to store results and optimize API calls, ensuring faster responses for repeated requests.
- Fetches weather data using an external API (https://openweathermap.org/)
- Caches responses to reduce redundant API calls.
- Implements RSpec tests for validation.
Ensure you have the following installed:
- Ruby 3.2.2
- Rails 7.x
- Bundler
-
Clone the repository:
git clone https://github.com/GandalftheGUI/weather.git cd weather
-
Install dependencies:
bundle install
-
Sign up for a free account at https://openweathermap.org/ and find your API key.
-
Set up the environment variables: Create a
.env
file in the root directory and add your API key from the previous step:OPENWEATHER_API_KEY=your_api_key_here
You may need to use
dotenv
gem to load environment variables. -
Run the server:
bin/dev
Access the app at
http://localhost:3000
.
To run RSpec tests, use:
rspec