Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 32 lines (23 sloc) 1.093 kb
f6d642f Initial commit.
Carlos Kozuszko authored
1 == rweather
2
3 Ruby gem to access Weather Channel (weather.com) XML API.
4
b0c9740 @ckozus Adding documentation and a little example.
authored
5 This gems lets you access to the search and get current conditions features. Forecast it's not implemented yet.
6
7 In order to use the API you will need first to get your partner_id and licence key from weather.com at this address:
8 http://www.weather.com/services/xmloap.html
9
10 Sign up, enter all your data and you'll get an email with the partner_id, licence key and a link to download the SDK info.
11 If you need to read the license agreement and the API doc you can do it here:
12 http://download.weather.com/web/xml/sdk.zip
13
14 == Example
15
16 require 'rubygems'
17 require 'r_weather'
18
19 RWeather.partner_id = "xxxxxxxxxx"
20 RWeather.key = "yyyyyyyyyyyyyyyy"
21
22 locations = RWeather.search('tucuman') # that's where I'm from :)
23 unless locations.empty?
24 locations.each_with_index do |location, i|
25 puts "#{i}) #{location.id} - #{location.name}"
26 end
27 cc = RWeather.current_conditions(locations.first.id)
28 puts "Current conditions: "
29 puts " Temperature: #{cc.tmp}"
30 puts " Feels like: #{cc.flik}"
31 end
Something went wrong with that request. Please try again.