CLI Weather is a Ruby CLI application returns the National Weather Service forecast based on an address value input by the user. The user is invited to interact with the application to choose how the weather information is retrieved - by zip code, by city/state, or by full address. As a runner, I keep my eye on the forecast by hour so I can anticipate how the weather will feel and whether the road surface is dry or slippery. This project idea allowed me to play with weather data.
I used the forecast page by zip code for my location in Bloomington MN. My original goal was to scrape the Tabular Forecast for a locality but the data is not well-labeled for easy scraping.
This project is protected under the MIT License.
The project has the following dependencies:
- httparty (gem): https://github.com/jnunemaker/httparty: This gem is used to connect with APIs.
- positionstack (API): https://positionstack.com/: This API provides geolocation information based on address input. Requires key (free).
- Rake (gem): https://github.com/ruby/rake: This gem allows the application to run for testing.
- rspec (gem): http://rspec.info/: This gem is a test runner.
The general process flow is diagrammed as a Lucid chart. The main classes used in processing:
- DisplayWeather
Runs the application - Address
Gets and confirms (as best as possible) the address - Weather
Holds the Weather object and things the Weather object does - Geolocation
Performs the lookup based on selected address - Scraper
Gets the data from the source (currently only NWS)
This project can be cloned and run from the command line within the cli-weather
folder:
./bin/weather
Future enhancements include:
- Using the NWS API
- Add other weather websites as options
- Add other weather APIs as options
Please contact me on GitHub if you are interested in contributing. I will reach out once I have completed a detailed contributor guide for the project.