Given an address, show local forecast and High/Low temperatures for the current day and the next two.
Written in Ruby on Rails 7.1, this app allows you to look up the current and forecasted weather for a location. A location can be a specific address, a point of interest, or a zip code. Upon typing the address, the app will look up address suggestions from Mapbox API and display them in a dropdown below the search field. Click on any suggestion to get weather details at that location.
- Address suggestions are provided by [Mapbox API](https://docs.mapbox.com/api/search/search-box/.
- Weather details are provided by Weather API
- If an address is selected from the address suggestions dropdown or a zip code is entered directly, weather data is cached by zip code for 30 minutes.
- Ruby 3.1.4
- Rails 7.1.3.2
- Bundler 2.3.26
The MAPBOX_API_ACCESS_TOKEN and MAPBOX_API_URL environment variables are required to fetch
address suggestions from Mapbox API. The WEATHER_API_URL, WEATHER_API_KEY, and WEATHER_API_HOST
env variables are required to access Weather API.
You'll need account credentials for Mapbox API and Weather API. Links are provided above in Features section
Create a .env file and set these variables with your credentials. Refer to .env.sample as an example.
If the caching of weather data does not appear to be working, you may need to run rails dev:cache if you're in the development environment. Also, recall that if a zip code was not included in the search string, the request will not be cached
Run full test suite and the test coverage will appear on the last line:
$ bundle exec rspecTo see test coverage details:
$ open coverage/index.htmlTo see any linting errors:
$ rubocop