Project

nws

0.0
No release in over 3 years
A Ruby gem to access the publicly available National Weather Service (USA) APIs for returning condition and forecast data.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 5.0
~> 13.0
~> 3.0
 Project Readme

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 CO

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