NWS
Ruby client for the National Weather Service API.
Installation
gem install nws
CLI Usage
nws forecast --location "Denver, CO"
nws hourly --lat 39.7456 --lon -104.9892
nws current --location "80202"
nws alerts --state COUse -o json for JSON output.
Library Usage
require 'nws'
# 7-day forecast
forecast = NWS.forecast(39.7456, -104.9892)
puts forecast.today
# Hourly forecast
hourly = NWS.hourly_forecast(39.7456, -104.9892)
hourly.next_hours(12).each { |h| puts h }
# Current conditions
conditions = NWS.current_conditions(39.7456, -104.9892)
puts conditions.summary
# Alerts
alerts = NWS.alerts(state: "CO")
alerts.each { |a| puts a.headline }Geocoding
Location lookups use OpenStreetMap Nominatim with rate limiting and caching.
License
Public domain. See LICENSE.