Skip to content

Given an address, show local forecast and High/Low temperatures for the day

Notifications You must be signed in to change notification settings

dsadaka/weather

Repository files navigation

Weather

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.

Screenshot

Features

  • 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.

Give it a try at...

http://apple.web-site1.com

Dependencies

  • Ruby 3.1.4
  • Rails 7.1.3.2
  • Bundler 2.3.26

Troubleshooting

Environment variables

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.

Caching

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

Tests

Run full test suite and the test coverage will appear on the last line:

$ bundle exec rspec

To see test coverage details:

$ open coverage/index.html

To see any linting errors:

$ rubocop

Credits

https://github.com/danwa5

https://github.com/joelparkerhenderson

About

Given an address, show local forecast and High/Low temperatures for the day

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published