rubyweather 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +24 -21
- data/lib/weather/service.rb +2 -2
- metadata +91 -84
data/README
CHANGED
@@ -22,16 +22,36 @@ RubyWeather can also be installed as a Rails plugin using the following command
|
|
22
22
|
directory:
|
23
23
|
|
24
24
|
./script/plugin install -x http://rubyweather.googlecode.com/svn/trunk
|
25
|
+
|
26
|
+
|
27
|
+
== Obtaining a Free Weather.com License
|
28
|
+
|
29
|
+
To use this library you will need a partner id and license key from
|
30
|
+
weather.com. The service is completely free, but requires that you agree
|
31
|
+
to weather.com's legal stuff, which, among other things, asks that your software
|
32
|
+
to include a link back to the weather.com website (although this is not actually
|
33
|
+
enforced in any way by the service).
|
34
|
+
|
35
|
+
To obtain the free license visit http://www.weather.com/services/xmloap.html.
|
36
|
+
This will also allow you to download an SDK that includes nice weather icons for
|
37
|
+
use with the data.
|
38
|
+
|
39
|
+
Note that weather.com doesn't seem to be enforcing the partner id/license key at this time.
|
40
|
+
You can specify any value for partner id and license key (e.g. par=123456&key=abcdefg) and
|
41
|
+
the weather.com service will happily accept it (in fact, you can even leave both fields blank,
|
42
|
+
i.e. part=&key=). However, this is probably unintentional and subject to change, so it is
|
43
|
+
highly recommended that you obtain a valid id and key.
|
25
44
|
|
26
45
|
|
27
46
|
=== Examples
|
28
47
|
|
29
|
-
First, we need to find
|
30
|
-
|
48
|
+
First, we need to find the weather.com location code for your city.
|
49
|
+
|
50
|
+
The following Ruby code will print out a list of locations and their codes
|
31
51
|
matching the string "Toronto":
|
32
52
|
|
33
53
|
require 'rubygems'
|
34
|
-
|
54
|
+
gem 'rubyweather'
|
35
55
|
|
36
56
|
require 'weather/service'
|
37
57
|
|
@@ -42,7 +62,7 @@ matching the string "Toronto":
|
|
42
62
|
locations = service.find_location('Toronto')
|
43
63
|
puts "Matching Locations: " + locations.inspect
|
44
64
|
|
45
|
-
We can now use the code to fetch the weather data for our city:
|
65
|
+
We can now use location the code to fetch the weather data for our city:
|
46
66
|
|
47
67
|
forecast = service.fetch_forecast("CAXX0504", 5)
|
48
68
|
|
@@ -130,23 +150,6 @@ a simple weather forecast. To try this out:
|
|
130
150
|
|
131
151
|
Fire up your Rails server, and go to <tt>/weather_portlet/forecast</tt> to see the controller in action.
|
132
152
|
|
133
|
-
== Note About Weather.com Licensing & Registration
|
134
|
-
|
135
|
-
To use this library you will need a partner id and license key from
|
136
|
-
weather.com. The service is completely free, but requires that you agree
|
137
|
-
to weather.com's legal stuff, which, among other things, asks that your software
|
138
|
-
to include a link back to the weather.com website (although this is not actually
|
139
|
-
enforced in any way by the service).
|
140
|
-
|
141
|
-
To obtain the free license visit http://www.weather.com/services/xmloap.html.
|
142
|
-
This will also allow you to download an SDK that includes nice weather icons for
|
143
|
-
use with the data.
|
144
|
-
|
145
|
-
Note that weather.com doesn't seem to be enforcing the partner id/license key at this time.
|
146
|
-
You can specify any value for partner id and license key (e.g. par=123456&key=abcdefg) and
|
147
|
-
the weather.com service will happily accept it (in fact, you can even leave both fields blank,
|
148
|
-
i.e. part=&key=). However, this is probably unintentional and subject to change, so it is
|
149
|
-
highly recommended that you obtain a valid id and key.
|
150
153
|
|
151
154
|
== Software License
|
152
155
|
|
data/lib/weather/service.rb
CHANGED
@@ -64,9 +64,9 @@ module Weather
|
|
64
64
|
|
65
65
|
# default to metric (degrees fahrenheit are just silly :)
|
66
66
|
unit = imperial ? "s" : "m"
|
67
|
-
url = "/weather/local/#{location_id}?cc=*&dayf=#{days}&
|
67
|
+
url = "/weather/local/#{location_id}?cc=*&dayf=#{days}&par=#{partner_id}&key=#{license_key}&unit=#{unit}"
|
68
68
|
|
69
|
-
#
|
69
|
+
#puts "Using url: "+url
|
70
70
|
|
71
71
|
if cache?
|
72
72
|
begin
|
metadata
CHANGED
@@ -1,119 +1,126 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.0
|
3
|
-
specification_version: 1
|
4
2
|
name: rubyweather
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.2.
|
7
|
-
date: 2007-04-04 00:00:00 -04:00
|
8
|
-
summary: Client library for accessing weather.com's xoap weather data.
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: matt@roughest.net
|
12
|
-
homepage: http://rubyforge.org/projects/rubyweather
|
13
|
-
rubyforge_project: rubyweather
|
14
|
-
description: RubyWeather is a Ruby library for fetching weather forecast data from weather.com. The library provides a nice Ruby-like abstraction layer for interacting with the service. Note that (free) registration with weather.com is required to access multi-day forecasts.
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 1.2.1
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Matt Zukowski
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-05-06 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: RubyWeather is a Ruby library for fetching weather forecast data from weather.com. The library provides a nice Ruby-like abstraction layer for interacting with the service. Note that (free) registration with weather.com is required to access multi-day forecasts.
|
17
|
+
email: matt@roughest.net
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
- LICENSE
|
31
25
|
files:
|
26
|
+
- weather.rb
|
32
27
|
- install.rb
|
33
28
|
- init.rb
|
34
|
-
- weather.rb
|
35
29
|
- lib/libxml_rexml_compat.rb
|
36
|
-
- lib/weather/forecast.rb
|
37
30
|
- lib/weather/service.rb
|
31
|
+
- lib/weather/forecast.rb
|
38
32
|
- lib/weather/util.rb
|
39
|
-
- README
|
40
33
|
- LICENSE
|
41
|
-
-
|
34
|
+
- README
|
35
|
+
- test/examples_test.rb
|
42
36
|
- test/forecast_test.rb
|
43
37
|
- test/profiler.rb
|
44
|
-
- test/
|
38
|
+
- test/service_test.rb
|
45
39
|
- test/test_weather.xml
|
46
|
-
- example/weather_portlet_controller.rb
|
47
40
|
- example/weather_32
|
48
|
-
- example/
|
49
|
-
- example/weather_32/
|
50
|
-
- example/weather_32/
|
41
|
+
- example/weather_32/0.png
|
42
|
+
- example/weather_32/1.png
|
43
|
+
- example/weather_32/2.png
|
44
|
+
- example/weather_32/3.png
|
51
45
|
- example/weather_32/4.png
|
52
|
-
- example/weather_32/
|
46
|
+
- example/weather_32/5.png
|
47
|
+
- example/weather_32/6.png
|
48
|
+
- example/weather_32/7.png
|
49
|
+
- example/weather_32/8.png
|
50
|
+
- example/weather_32/9.png
|
51
|
+
- example/weather_32/Thumbs.db
|
53
52
|
- example/weather_32/na.png
|
54
|
-
- example/weather_32/
|
55
|
-
- example/weather_32/40.png
|
56
|
-
- example/weather_32/25.png
|
57
|
-
- example/weather_32/29.png
|
58
|
-
- example/weather_32/16.png
|
59
|
-
- example/weather_32/28.png
|
53
|
+
- example/weather_32/10.png
|
60
54
|
- example/weather_32/11.png
|
61
|
-
- example/weather_32/
|
55
|
+
- example/weather_32/12.png
|
62
56
|
- example/weather_32/13.png
|
63
|
-
- example/weather_32/
|
64
|
-
- example/weather_32/
|
65
|
-
- example/weather_32/
|
57
|
+
- example/weather_32/14.png
|
58
|
+
- example/weather_32/15.png
|
59
|
+
- example/weather_32/16.png
|
60
|
+
- example/weather_32/17.png
|
66
61
|
- example/weather_32/18.png
|
67
|
-
- example/weather_32/3.png
|
68
|
-
- example/weather_32/35.png
|
69
62
|
- example/weather_32/19.png
|
70
|
-
- example/weather_32/31.png
|
71
|
-
- example/weather_32/24.png
|
72
|
-
- example/weather_32/23.png
|
73
|
-
- example/weather_32/10.png
|
74
|
-
- example/weather_32/46.png
|
75
|
-
- example/weather_32/8.png
|
76
63
|
- example/weather_32/20.png
|
77
|
-
- example/weather_32/6.png
|
78
|
-
- example/weather_32/22.png
|
79
|
-
- example/weather_32/1.png
|
80
|
-
- example/weather_32/47.png
|
81
|
-
- example/weather_32/17.png
|
82
|
-
- example/weather_32/2.png
|
83
|
-
- example/weather_32/38.png
|
84
|
-
- example/weather_32/44.png
|
85
|
-
- example/weather_32/Thumbs.db
|
86
|
-
- example/weather_32/15.png
|
87
|
-
- example/weather_32/0.png
|
88
|
-
- example/weather_32/7.png
|
89
64
|
- example/weather_32/21.png
|
90
|
-
- example/weather_32/
|
91
|
-
- example/weather_32/
|
65
|
+
- example/weather_32/22.png
|
66
|
+
- example/weather_32/23.png
|
67
|
+
- example/weather_32/24.png
|
68
|
+
- example/weather_32/25.png
|
69
|
+
- example/weather_32/26.png
|
70
|
+
- example/weather_32/27.png
|
71
|
+
- example/weather_32/28.png
|
72
|
+
- example/weather_32/29.png
|
92
73
|
- example/weather_32/30.png
|
93
|
-
- example/weather_32/
|
74
|
+
- example/weather_32/31.png
|
75
|
+
- example/weather_32/32.png
|
76
|
+
- example/weather_32/33.png
|
94
77
|
- example/weather_32/34.png
|
95
|
-
- example/weather_32/
|
78
|
+
- example/weather_32/35.png
|
79
|
+
- example/weather_32/36.png
|
96
80
|
- example/weather_32/37.png
|
97
|
-
- example/weather_32/
|
98
|
-
- example/weather_32/
|
99
|
-
|
100
|
-
-
|
101
|
-
-
|
102
|
-
-
|
81
|
+
- example/weather_32/38.png
|
82
|
+
- example/weather_32/39.png
|
83
|
+
- example/weather_32/40.png
|
84
|
+
- example/weather_32/41.png
|
85
|
+
- example/weather_32/42.png
|
86
|
+
- example/weather_32/43.png
|
87
|
+
- example/weather_32/44.png
|
88
|
+
- example/weather_32/45.png
|
89
|
+
- example/weather_32/46.png
|
90
|
+
- example/weather_32/47.png
|
91
|
+
- example/weather_portlet_controller.rb
|
92
|
+
- example/forecast.rhtml
|
93
|
+
has_rdoc: true
|
94
|
+
homepage: http://rubyforge.org/projects/rubyweather
|
95
|
+
post_install_message:
|
103
96
|
rdoc_options:
|
104
97
|
- --title
|
105
|
-
- RubyWeather 1.2.
|
98
|
+
- RubyWeather 1.2.1 RDocs
|
106
99
|
- --main
|
107
100
|
- README
|
108
101
|
- --line-numbers
|
109
|
-
|
110
|
-
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: "0"
|
109
|
+
version:
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: "0"
|
115
|
+
version:
|
116
116
|
requirements: []
|
117
117
|
|
118
|
-
|
119
|
-
|
118
|
+
rubyforge_project: rubyweather
|
119
|
+
rubygems_version: 1.0.1
|
120
|
+
signing_key:
|
121
|
+
specification_version: 2
|
122
|
+
summary: Client library for accessing weather.com's xoap weather data.
|
123
|
+
test_files:
|
124
|
+
- test/examples_test.rb
|
125
|
+
- test/forecast_test.rb
|
126
|
+
- test/service_test.rb
|