Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better formatting for README #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
WeatherMan
=========

A Ruby Gem that wraps the Weather Channel, inc. XML data feed
written by Jared Pace, Codeword: Studios (http://codewordstudios.com),
based on the rweather[http://github.com/ckozus/rweather] gem by Carlos Kozuszko - http://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:

```ruby
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:

```ruby
# 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:

```ruby
# 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:

```ruby
# 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:

```ruby
# The array of pr links
weather.links

# Getting the first links text and url
weather.links.first.text
weather.links.first.url
```

<b>TODO:</b> Document all attributes
93 changes: 0 additions & 93 deletions README.rdoc

This file was deleted.