github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jdpace / weatherman

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 16
    • 2
  • Source
  • Commits
  • Network (2)
  • Issues (1)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Ruby gem for accessing the Weather Channel XML API — Read more

  cancel

http://codewordstudios.com

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Capture the weather locations local time in the response object. 
jdpace (author)
Fri Oct 03 17:52:45 -0700 2008
commit  7541bc6445cec385b40a5a6d98309a0dca27efe6
tree    15dc4962d43f2fe73d4c3d41325637a590620fed
parent  91f16fdc2fcb3a5b4602a320ba3a07a520db29a5
weatherman /
name age
history
message
file .gitignore Wed Sep 24 18:59:02 -0700 2008 Initial Commit. [jdpace]
file README.rdoc Mon Sep 29 19:06:20 -0700 2008 Fix README.rdoc to show correct gem install name [jdpace]
directory lib/ Fri Oct 03 17:52:45 -0700 2008 Capture the weather locations local time in the... [jdpace]
directory spec/ Fri Oct 03 17:52:45 -0700 2008 Capture the weather locations local time in the... [jdpace]
file weatherman.gemspec Loading commit data...
README.rdoc

WeatherMan

A Ruby Gem that wraps the Weather Channel, inc. XML data feed written by Jared Pace, Codeword: Studios (codewordstudios.com), based on the rweather gem by Carlos Kozuszko - www.ckozus.com.ar/blog/.

Dependencies

  1. XmlSimple
         `gem install xml-simple`
    

Installation

        % sudo gem sources -a http://gems.github.com # (if you haven't already)
        % sudo gem install jdpace-weatherman

Usage

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 = WeatherMan.search('New York')

        # or if you know the location id or just want to use a US Zip code
        ny = WeatherMan.new('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.today
        weather.forecast.tomorrow
        weather.forecast.monday
        weather.forecast.for(Date.today)
        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
        friday.day.description # Partly Cloudy, Sunny...
        friday.day.chance_percipitation # 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

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server