Skip to content
Ruby gem for accessing the Weather Channel XML API
Find file
New pull request
Pull request Compare This branch is 2 commits behind jdpace:master.
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



A Ruby Gem that wraps the Weather Channel, inc. XML data feed written by Jared Pace, Codeword: Studios (, based on the rweather gem by Carlos Kozuszko -


  1. XmlSimple

`gem install xml-simple`


% sudo gem sources -a # (if you haven't already) % sudo gem install jdpace-weatherman


Find or load a location:

require 'weather_man' WeatherMan.partner_id = '0123456789' WeatherMan.license_key = '0123456789abcdef' # Search for a location # Returns an array of WeatherMan objects locations ='New York') # or if you know the location id or just want to use a US Zip code ny ='USNY0996') Fetch the weather: # Fetch the current conditions and 5 day forecast in 'standard' units weather = ny.fetch # Fetch only current conditions in metric units weather = ny.fetch(:days => 0, :unit => 'm') # Fetch a 3 day forecast only weather = ny.fetch(:days => 3, :current_conditions => false) Look at the Current Conditions:

# current temperature temp = weather.current_conditions.temperature feels_like = weather.current_conditions.feels_like wind_speed = weather.current_conditions.wind.speed wind_direction = weather.current_conditions.wind.direction Look at the forecast:

# how many days? weather.forecast.size # Some different forecasts weather.forecast.tomorrow weather.forecast.monday weather.forecast.for( weather.forecast.for(3.days.from_now) # Note: using rails core extensions weather.forecast.for('Sep 1') # data for a forecast friday = weather.forecast.friday high_temp = friday.high low_temp = friday.low # forecasts are split into 2 parts day/night # Partly Cloudy, Sunny… # 0..100 night_wind_speed = friday.night.wind.speed The Weather Channel requires that you 4 promotional links for them if you use their service. Here's how to access those links:

# The array of pr links weather.links # Getting the first links text and url weather.links.first.text weather.links.first.url TODO: Document all attributes

Something went wrong with that request. Please try again.