attack-barometer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.rdoc +266 -0
- data/VERSION.yml +4 -0
- data/bin/barometer +63 -0
- data/lib/barometer/base.rb +52 -0
- data/lib/barometer/data/current.rb +93 -0
- data/lib/barometer/data/distance.rb +131 -0
- data/lib/barometer/data/forecast.rb +66 -0
- data/lib/barometer/data/geo.rb +98 -0
- data/lib/barometer/data/location.rb +20 -0
- data/lib/barometer/data/measurement.rb +161 -0
- data/lib/barometer/data/pressure.rb +133 -0
- data/lib/barometer/data/speed.rb +147 -0
- data/lib/barometer/data/sun.rb +35 -0
- data/lib/barometer/data/temperature.rb +164 -0
- data/lib/barometer/data/units.rb +55 -0
- data/lib/barometer/data/zone.rb +124 -0
- data/lib/barometer/data.rb +15 -0
- data/lib/barometer/extensions/graticule.rb +50 -0
- data/lib/barometer/extensions/httparty.rb +21 -0
- data/lib/barometer/query.rb +228 -0
- data/lib/barometer/services/google.rb +146 -0
- data/lib/barometer/services/noaa.rb +6 -0
- data/lib/barometer/services/service.rb +324 -0
- data/lib/barometer/services/weather_bug.rb +6 -0
- data/lib/barometer/services/weather_dot_com.rb +6 -0
- data/lib/barometer/services/wunderground.rb +285 -0
- data/lib/barometer/services/yahoo.rb +274 -0
- data/lib/barometer/services.rb +6 -0
- data/lib/barometer/weather.rb +187 -0
- data/lib/barometer.rb +52 -0
- data/spec/barometer_spec.rb +162 -0
- data/spec/data_current_spec.rb +225 -0
- data/spec/data_distance_spec.rb +336 -0
- data/spec/data_forecast_spec.rb +150 -0
- data/spec/data_geo_spec.rb +90 -0
- data/spec/data_location_spec.rb +59 -0
- data/spec/data_measurement_spec.rb +411 -0
- data/spec/data_pressure_spec.rb +336 -0
- data/spec/data_speed_spec.rb +374 -0
- data/spec/data_sun_spec.rb +76 -0
- data/spec/data_temperature_spec.rb +396 -0
- data/spec/data_zone_spec.rb +133 -0
- data/spec/fixtures/current_calgary_ab.xml +1 -0
- data/spec/fixtures/forecast_calgary_ab.xml +1 -0
- data/spec/fixtures/geocode_40_73.xml +1 -0
- data/spec/fixtures/geocode_90210.xml +1 -0
- data/spec/fixtures/geocode_T5B4M9.xml +1 -0
- data/spec/fixtures/geocode_calgary_ab.xml +1 -0
- data/spec/fixtures/geocode_newyork_ny.xml +1 -0
- data/spec/fixtures/google_calgary_ab.xml +1 -0
- data/spec/fixtures/yahoo_90210.xml +1 -0
- data/spec/query_spec.rb +469 -0
- data/spec/service_google_spec.rb +144 -0
- data/spec/service_wunderground_spec.rb +330 -0
- data/spec/service_yahoo_spec.rb +299 -0
- data/spec/services_spec.rb +1106 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/units_spec.rb +101 -0
- data/spec/weather_spec.rb +265 -0
- metadata +119 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Sun" do
|
4
|
+
|
5
|
+
describe "when initialized" do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@sun = Barometer::Sun.new
|
9
|
+
@time_rise = Time.now
|
10
|
+
@time_set = Time.now + (60*60*8)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "responds to rise" do
|
14
|
+
@sun.respond_to?("rise").should be_true
|
15
|
+
end
|
16
|
+
|
17
|
+
it "responds to set" do
|
18
|
+
@sun.respond_to?("set").should be_true
|
19
|
+
end
|
20
|
+
|
21
|
+
it "sets sunrise" do
|
22
|
+
sun = Barometer::Sun.new(@time_rise,@time_set)
|
23
|
+
sun.rise.should == @time_rise
|
24
|
+
end
|
25
|
+
|
26
|
+
it "sets sunset" do
|
27
|
+
sun = Barometer::Sun.new(@time_rise,@time_set)
|
28
|
+
sun.set.should == @time_set
|
29
|
+
end
|
30
|
+
|
31
|
+
it "requires Time for sunrise" do
|
32
|
+
lambda { Barometer::Sun.new("",@time_set) }.should raise_error(ArgumentError)
|
33
|
+
lambda { Barometer::Sun.new(@time_rise,@time_set) }.should_not raise_error(ArgumentError)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "requires Time for sunset" do
|
37
|
+
lambda { Barometer::Sun.new(@time_rise,"") }.should raise_error(ArgumentError)
|
38
|
+
lambda { Barometer::Sun.new(@time_rise,@time_set) }.should_not raise_error(ArgumentError)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "responds to nil?" do
|
42
|
+
@sun.nil?.should be_true
|
43
|
+
sun = Barometer::Sun.new(@time_rise, @time_set)
|
44
|
+
sun.nil?.should be_false
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "when adjusting times" do
|
50
|
+
|
51
|
+
before(:each) do
|
52
|
+
@time_rise = Time.now
|
53
|
+
@time_set = Time.now + (60*60*8)
|
54
|
+
@sun = Barometer::Sun.new(@time_rise, @time_set)
|
55
|
+
end
|
56
|
+
|
57
|
+
it "requires a Barometer::Sun object" do
|
58
|
+
lambda { Barometer::Sun.add_days!("invalid") }.should raise_error(ArgumentError)
|
59
|
+
lambda { Barometer::Sun.add_days!(@sun) }.should_not raise_error(ArgumentError)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "requires a Fixnum object" do
|
63
|
+
lambda { Barometer::Sun.add_days!(@sun,1.1) }.should raise_error(ArgumentError)
|
64
|
+
lambda { Barometer::Sun.add_days!(@sun,1) }.should_not raise_error(ArgumentError)
|
65
|
+
end
|
66
|
+
|
67
|
+
it "adds X days to both sun_rise and sun_set" do
|
68
|
+
days_to_add = 2
|
69
|
+
new_sun = Barometer::Sun.add_days!(@sun, days_to_add)
|
70
|
+
new_sun.rise.should == @sun.rise + (60*60*24*days_to_add)
|
71
|
+
new_sun.set.should == @sun.set + (60*60*24*days_to_add)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -0,0 +1,396 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Temperature" do
|
4
|
+
|
5
|
+
describe "when initialized" do
|
6
|
+
|
7
|
+
it "defines METRIC_UNITS" do
|
8
|
+
Barometer::Temperature.const_defined?("METRIC_UNITS").should be_true
|
9
|
+
Barometer::Temperature::METRIC_UNITS.should == "C"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "defines IMPERIAL_UNITS" do
|
13
|
+
Barometer::Temperature.const_defined?("IMPERIAL_UNITS").should be_true
|
14
|
+
Barometer::Temperature::IMPERIAL_UNITS.should == "F"
|
15
|
+
end
|
16
|
+
|
17
|
+
before(:each) do
|
18
|
+
@temp = Barometer::Temperature.new
|
19
|
+
end
|
20
|
+
|
21
|
+
it "responds to celcius" do
|
22
|
+
@temp.celsius.should be_nil
|
23
|
+
end
|
24
|
+
|
25
|
+
it "responds to fahrenheit" do
|
26
|
+
@temp.fahrenheit.should be_nil
|
27
|
+
end
|
28
|
+
|
29
|
+
it "responds to kelvin" do
|
30
|
+
@temp.kelvin.should be_nil
|
31
|
+
end
|
32
|
+
|
33
|
+
it "responds to metric_default" do
|
34
|
+
lambda { @temp.metric_default = 5 }.should_not raise_error(NotImplementedError)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "responds to imperial_default" do
|
38
|
+
lambda { @temp.imperial_default = 5 }.should_not raise_error(NotImplementedError)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "responds to nil?" do
|
42
|
+
@temp.nil?.should be_true
|
43
|
+
@temp.c = 5
|
44
|
+
@temp.nil?.should be_false
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "conversion" do
|
50
|
+
|
51
|
+
# For all conversions
|
52
|
+
# 20.0 C = 293.15 K = 68.0 F
|
53
|
+
before(:each) do
|
54
|
+
@f = 68.0
|
55
|
+
@c = 20.0
|
56
|
+
@k = 293.15
|
57
|
+
end
|
58
|
+
|
59
|
+
it "requires a value, that is either Integer or Float" do
|
60
|
+
Barometer::Temperature.c_to_k(nil).should be_nil
|
61
|
+
Barometer::Temperature.c_to_f(nil).should be_nil
|
62
|
+
Barometer::Temperature.f_to_k(nil).should be_nil
|
63
|
+
Barometer::Temperature.f_to_c(nil).should be_nil
|
64
|
+
Barometer::Temperature.k_to_c(nil).should be_nil
|
65
|
+
Barometer::Temperature.k_to_f(nil).should be_nil
|
66
|
+
|
67
|
+
not_float_or_integer = "string"
|
68
|
+
Barometer::Temperature.c_to_k(not_float_or_integer).should be_nil
|
69
|
+
Barometer::Temperature.c_to_f(not_float_or_integer).should be_nil
|
70
|
+
Barometer::Temperature.f_to_k(not_float_or_integer).should be_nil
|
71
|
+
Barometer::Temperature.f_to_c(not_float_or_integer).should be_nil
|
72
|
+
Barometer::Temperature.k_to_c(not_float_or_integer).should be_nil
|
73
|
+
Barometer::Temperature.k_to_f(not_float_or_integer).should be_nil
|
74
|
+
end
|
75
|
+
|
76
|
+
it "converts C to K" do
|
77
|
+
# 0 C = 273.15 K
|
78
|
+
Barometer::Temperature.c_to_k(@c).should == @k
|
79
|
+
end
|
80
|
+
|
81
|
+
it "converts C to F" do
|
82
|
+
# Tf = (9/5)*Tc+32
|
83
|
+
Barometer::Temperature.c_to_f(@c).should == @f
|
84
|
+
end
|
85
|
+
|
86
|
+
it "converts F to C" do
|
87
|
+
# Tc = (5/9)*(Tf-32)
|
88
|
+
Barometer::Temperature.f_to_c(@f).should == @c
|
89
|
+
end
|
90
|
+
|
91
|
+
it "converts F to K" do
|
92
|
+
Barometer::Temperature.f_to_k(@f).should == @k
|
93
|
+
end
|
94
|
+
|
95
|
+
it "converts K to C" do
|
96
|
+
Barometer::Temperature.k_to_c(@k).should == @c
|
97
|
+
end
|
98
|
+
|
99
|
+
it "converts K to F" do
|
100
|
+
Barometer::Temperature.k_to_f(@k).should == @f
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
describe "updating" do
|
106
|
+
|
107
|
+
before(:each) do
|
108
|
+
@temp = Barometer::Temperature.new
|
109
|
+
@f = 68.0
|
110
|
+
@c = 20.0
|
111
|
+
end
|
112
|
+
|
113
|
+
it "nils F if new C converts to a F that changes more then 1 degree" do
|
114
|
+
@temp.fahrenheit = (@f + 1.1)
|
115
|
+
@temp.update_fahrenheit(@c)
|
116
|
+
@temp.fahrenheit.should be_nil
|
117
|
+
end
|
118
|
+
|
119
|
+
it "doesn't update F if new C converts to a F that does not change more then 1 degree" do
|
120
|
+
@temp.fahrenheit = (@f + 0.9)
|
121
|
+
@temp.update_fahrenheit(@c)
|
122
|
+
@temp.fahrenheit.should == (@f + 0.9)
|
123
|
+
end
|
124
|
+
|
125
|
+
it "doesn't set F if not already set" do
|
126
|
+
@temp.fahrenheit.should be_nil
|
127
|
+
@temp.celsius.should be_nil
|
128
|
+
@temp.update_fahrenheit(@c)
|
129
|
+
@temp.fahrenheit.should be_nil
|
130
|
+
@temp.celsius.should be_nil
|
131
|
+
end
|
132
|
+
|
133
|
+
it "nils C if new F converts to a C that changes more then 1 degree" do
|
134
|
+
@temp.celsius = (@c + 1.1)
|
135
|
+
@temp.update_celsius(@f)
|
136
|
+
@temp.celsius.should be_nil
|
137
|
+
end
|
138
|
+
|
139
|
+
it "doesn't update C if new F converts to a C that does not change more then 1 degree" do
|
140
|
+
@temp.celsius = (@c + 0.9)
|
141
|
+
@temp.update_celsius(@f)
|
142
|
+
@temp.celsius.should == (@c + 0.9)
|
143
|
+
end
|
144
|
+
|
145
|
+
it "doesn't set C if not already set" do
|
146
|
+
@temp.fahrenheit.should be_nil
|
147
|
+
@temp.celsius.should be_nil
|
148
|
+
@temp.update_celsius(@f)
|
149
|
+
@temp.fahrenheit.should be_nil
|
150
|
+
@temp.celsius.should be_nil
|
151
|
+
end
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
describe "storing" do
|
156
|
+
|
157
|
+
before(:each) do
|
158
|
+
@temp = Barometer::Temperature.new
|
159
|
+
@f = 68.0
|
160
|
+
@c = 20.0
|
161
|
+
@k = 293.15
|
162
|
+
end
|
163
|
+
|
164
|
+
it "doesn't update C if nil value (or equivalent)" do
|
165
|
+
@temp.celsius.should be_nil
|
166
|
+
@temp.c = nil
|
167
|
+
@temp.celsius.should be_nil
|
168
|
+
@temp.c = "na"
|
169
|
+
@temp.celsius.should be_nil
|
170
|
+
end
|
171
|
+
|
172
|
+
it "stores C, convert to K and reset F" do
|
173
|
+
@temp.celsius.should be_nil
|
174
|
+
@temp.fahrenheit = (@f + 1.1)
|
175
|
+
@temp.kelvin.should be_nil
|
176
|
+
@temp.c = @c
|
177
|
+
@temp.celsius.should == @c
|
178
|
+
@temp.kelvin.should == @k
|
179
|
+
@temp.fahrenheit.should be_nil
|
180
|
+
end
|
181
|
+
|
182
|
+
it "doesn't update F if nil value (or equivalent)" do
|
183
|
+
@temp.fahrenheit.should be_nil
|
184
|
+
@temp.f = nil
|
185
|
+
@temp.fahrenheit.should be_nil
|
186
|
+
@temp.f = "na"
|
187
|
+
@temp.fahrenheit.should be_nil
|
188
|
+
end
|
189
|
+
|
190
|
+
it "stores F, convert to K and reset C" do
|
191
|
+
@temp.fahrenheit.should be_nil
|
192
|
+
@temp.celsius = (@c + 1.1)
|
193
|
+
@temp.kelvin.should be_nil
|
194
|
+
@temp.f = @f
|
195
|
+
@temp.fahrenheit.should == @f
|
196
|
+
@temp.kelvin.should == @k
|
197
|
+
@temp.celsius.should be_nil
|
198
|
+
end
|
199
|
+
|
200
|
+
it "doesn't update K if nil value (or equivalent)" do
|
201
|
+
@temp.kelvin.should be_nil
|
202
|
+
@temp.k = nil
|
203
|
+
@temp.kelvin.should be_nil
|
204
|
+
@temp.k = "na"
|
205
|
+
@temp.kelvin.should be_nil
|
206
|
+
end
|
207
|
+
|
208
|
+
it "stores K, convert to F and C" do
|
209
|
+
@temp.celsius.should be_nil
|
210
|
+
@temp.fahrenheit.should be_nil
|
211
|
+
@temp.kelvin.should be_nil
|
212
|
+
@temp.k = @k
|
213
|
+
@temp.celsius.should == @c
|
214
|
+
@temp.fahrenheit.should == @f
|
215
|
+
@temp.kelvin.should == @k
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
describe "retrieving" do
|
221
|
+
|
222
|
+
before(:each) do
|
223
|
+
@temp = Barometer::Temperature.new
|
224
|
+
@f = 68.0
|
225
|
+
@c = 20.0
|
226
|
+
@k = 293.15
|
227
|
+
end
|
228
|
+
|
229
|
+
it "returns C if it exists" do
|
230
|
+
@temp.c = @c
|
231
|
+
@temp.celsius.should == @c
|
232
|
+
@temp.c.should == @c
|
233
|
+
end
|
234
|
+
|
235
|
+
it "auto converts from K if C is nil and K exists" do
|
236
|
+
@temp.f = @f
|
237
|
+
@temp.fahrenheit.should == @f
|
238
|
+
@temp.kelvin.should == @k
|
239
|
+
@temp.celsius.should be_nil
|
240
|
+
@temp.c.should == @c
|
241
|
+
end
|
242
|
+
|
243
|
+
it "allows a float to be returned for C" do
|
244
|
+
c = 20.12
|
245
|
+
@temp.c = c
|
246
|
+
@temp.celsius.should == c
|
247
|
+
@temp.c(true).should == c.to_i
|
248
|
+
@temp.c(false).should == c.to_f
|
249
|
+
end
|
250
|
+
|
251
|
+
it "allows only 2 decimal precision for C" do
|
252
|
+
c = 20.1234
|
253
|
+
@temp.c = c
|
254
|
+
@temp.celsius.should == c
|
255
|
+
@temp.c(false).should == 20.12
|
256
|
+
end
|
257
|
+
|
258
|
+
it "returns F if it exists" do
|
259
|
+
@temp.f = @f
|
260
|
+
@temp.fahrenheit.should == @f
|
261
|
+
@temp.f.should == @f
|
262
|
+
end
|
263
|
+
|
264
|
+
it "auto converts from K if F is nil and K exists" do
|
265
|
+
@temp.c = @c
|
266
|
+
@temp.celsius.should == @c
|
267
|
+
@temp.kelvin.should == @k
|
268
|
+
@temp.fahrenheit.should be_nil
|
269
|
+
@temp.f.should == @f
|
270
|
+
end
|
271
|
+
|
272
|
+
it "allows a float to be returned for F" do
|
273
|
+
f = 68.12
|
274
|
+
@temp.f = f
|
275
|
+
@temp.fahrenheit.should == f
|
276
|
+
@temp.f(true).should == f.to_i
|
277
|
+
@temp.f(false).should == f.to_f
|
278
|
+
end
|
279
|
+
|
280
|
+
it "allows only 2 decimal precision for F" do
|
281
|
+
f = 68.1234
|
282
|
+
@temp.f = f
|
283
|
+
@temp.fahrenheit.should == f
|
284
|
+
@temp.f(false).should == 68.12
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
describe "operators" do
|
290
|
+
|
291
|
+
before(:each) do
|
292
|
+
@f = 68.0
|
293
|
+
@c = 20.0
|
294
|
+
@k = 293.15
|
295
|
+
@temp_low = Barometer::Temperature.new
|
296
|
+
@temp_low.k = (@k - 1.0)
|
297
|
+
@temp_high = Barometer::Temperature.new
|
298
|
+
@temp_high.k = (@k + 1.0)
|
299
|
+
@temp = Barometer::Temperature.new
|
300
|
+
@temp.k = @k
|
301
|
+
@temp_same = Barometer::Temperature.new
|
302
|
+
@temp_same.k = @k
|
303
|
+
end
|
304
|
+
|
305
|
+
it "defines <=>" do
|
306
|
+
Barometer::Temperature.method_defined?("<=>").should be_true
|
307
|
+
(@temp_low <=> @temp_high).should == -1
|
308
|
+
(@temp_high <=> @temp_low).should == 1
|
309
|
+
(@temp <=> @temp_same).should == 0
|
310
|
+
end
|
311
|
+
|
312
|
+
it "defines <" do
|
313
|
+
Barometer::Temperature.method_defined?("<").should be_true
|
314
|
+
@temp_low.should < @temp_high
|
315
|
+
@temp_high.should_not < @temp_low
|
316
|
+
@temp.should_not < @temp_same
|
317
|
+
end
|
318
|
+
|
319
|
+
it "defines >" do
|
320
|
+
Barometer::Temperature.method_defined?(">").should be_true
|
321
|
+
@temp_low.should_not > @temp_high
|
322
|
+
@temp_high.should > @temp_low
|
323
|
+
@temp.should_not > @temp_same
|
324
|
+
end
|
325
|
+
|
326
|
+
it "defines ==" do
|
327
|
+
Barometer::Temperature.method_defined?("==").should be_true
|
328
|
+
@temp_low.should_not == @temp_high
|
329
|
+
@temp.should == @temp_same
|
330
|
+
end
|
331
|
+
|
332
|
+
it "defines <=" do
|
333
|
+
Barometer::Temperature.method_defined?("<=").should be_true
|
334
|
+
@temp_low.should <= @temp_high
|
335
|
+
@temp_high.should_not <= @temp_low
|
336
|
+
@temp.should <= @temp_same
|
337
|
+
end
|
338
|
+
|
339
|
+
it "defines >=" do
|
340
|
+
Barometer::Temperature.method_defined?(">=").should be_true
|
341
|
+
@temp_low.should_not >= @temp_high
|
342
|
+
@temp_high.should >= @temp_low
|
343
|
+
@temp.should >= @temp_same
|
344
|
+
end
|
345
|
+
|
346
|
+
end
|
347
|
+
|
348
|
+
describe "changing units" do
|
349
|
+
|
350
|
+
before(:each) do
|
351
|
+
@c = 20.5
|
352
|
+
@f = Barometer::Temperature.c_to_f(@c)
|
353
|
+
@k = Barometer::Temperature.c_to_k(@c)
|
354
|
+
@temp = Barometer::Temperature.new
|
355
|
+
@temp.k = @k
|
356
|
+
end
|
357
|
+
|
358
|
+
it "returns just the integer value (no units)" do
|
359
|
+
@temp.metric?.should be_true
|
360
|
+
@temp.to_i.should == @c.to_i
|
361
|
+
|
362
|
+
@temp.imperial!
|
363
|
+
@temp.metric?.should be_false
|
364
|
+
@temp.to_i.should == @f.to_i
|
365
|
+
end
|
366
|
+
|
367
|
+
it "returns just the float value (no units)" do
|
368
|
+
@temp.metric?.should be_true
|
369
|
+
@temp.to_f.should == @c.to_f
|
370
|
+
|
371
|
+
@temp.imperial!
|
372
|
+
@temp.metric?.should be_false
|
373
|
+
@temp.to_f.should == @f.to_f
|
374
|
+
end
|
375
|
+
|
376
|
+
it "returns just the integer value with units" do
|
377
|
+
@temp.metric?.should be_true
|
378
|
+
@temp.to_s.should == "#{@c.to_i} #{Barometer::Temperature::METRIC_UNITS}"
|
379
|
+
|
380
|
+
@temp.imperial!
|
381
|
+
@temp.metric?.should be_false
|
382
|
+
@temp.to_s.should == "#{@f.to_i} #{Barometer::Temperature::IMPERIAL_UNITS}"
|
383
|
+
end
|
384
|
+
|
385
|
+
it "returns just the units" do
|
386
|
+
@temp.metric?.should be_true
|
387
|
+
@temp.units.should == Barometer::Temperature::METRIC_UNITS
|
388
|
+
|
389
|
+
@temp.imperial!
|
390
|
+
@temp.metric?.should be_false
|
391
|
+
@temp.units.should == Barometer::Temperature::IMPERIAL_UNITS
|
392
|
+
end
|
393
|
+
|
394
|
+
end
|
395
|
+
|
396
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Zone" do
|
4
|
+
|
5
|
+
describe "and class methods" do
|
6
|
+
|
7
|
+
it "responds to now and returns Time object" do
|
8
|
+
Barometer::Zone.respond_to?("now").should be_true
|
9
|
+
Barometer::Zone.now.is_a?(Time).should be_true
|
10
|
+
end
|
11
|
+
|
12
|
+
it "responds to today and returns Date object" do
|
13
|
+
Barometer::Zone.respond_to?("today").should be_true
|
14
|
+
Barometer::Zone.today.is_a?(Date).should be_true
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "when initialized" do
|
20
|
+
|
21
|
+
before(:each) do
|
22
|
+
@utc = Time.now.utc
|
23
|
+
@timezone = "Europe/Paris"
|
24
|
+
@zone = Barometer::Zone.new(@timezone)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "responds to timezone" do
|
28
|
+
@zone.timezone.should_not be_nil
|
29
|
+
@zone.timezone.should == @timezone
|
30
|
+
end
|
31
|
+
|
32
|
+
it "responds to tz" do
|
33
|
+
lambda { Barometer::Zone.new("invalid timezone") }.should raise_error(TZInfo::InvalidTimezoneIdentifier)
|
34
|
+
|
35
|
+
zone = Barometer::Zone.new(@timezone)
|
36
|
+
zone.tz.should_not be_nil
|
37
|
+
end
|
38
|
+
|
39
|
+
it "responds to code" do
|
40
|
+
@zone.respond_to?("code").should be_true
|
41
|
+
zone = Barometer::Zone.new(@timezone)
|
42
|
+
zone.tz = nil
|
43
|
+
zone.tz.should be_nil
|
44
|
+
zone.code.should == ""
|
45
|
+
|
46
|
+
zone = Barometer::Zone.new(@timezone)
|
47
|
+
zone.code.should == "CEST"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "responds to dst?" do
|
51
|
+
@zone.respond_to?("dst?").should be_true
|
52
|
+
zone = Barometer::Zone.new(@timezone)
|
53
|
+
zone.tz = nil
|
54
|
+
zone.tz.should be_nil
|
55
|
+
zone.dst?.should be_nil
|
56
|
+
end
|
57
|
+
|
58
|
+
it "responds to now" do
|
59
|
+
@zone.respond_to?("now").should be_true
|
60
|
+
@zone.now.is_a?(Time).should be_true
|
61
|
+
end
|
62
|
+
|
63
|
+
it "responds to today" do
|
64
|
+
@zone.respond_to?("today").should be_true
|
65
|
+
@zone.today.is_a?(Date).should be_true
|
66
|
+
end
|
67
|
+
|
68
|
+
it "responds to now" do
|
69
|
+
Barometer::Zone.respond_to?("now").should be_true
|
70
|
+
end
|
71
|
+
|
72
|
+
it "responds to today" do
|
73
|
+
Barometer::Zone.respond_to?("today").should be_true
|
74
|
+
end
|
75
|
+
|
76
|
+
it "converts local_time to utc" do
|
77
|
+
local_time = Time.now.utc
|
78
|
+
utc_time = @zone.local_to_utc(local_time)
|
79
|
+
|
80
|
+
offset = @zone.tz.period_for_utc(local_time).utc_total_offset
|
81
|
+
utc_time.should == (local_time - offset)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "converts utc to local_time" do
|
85
|
+
utc_time = Time.now.utc
|
86
|
+
local_time = @zone.utc_to_local(utc_time)
|
87
|
+
|
88
|
+
offset = @zone.tz.period_for_utc(local_time).utc_total_offset
|
89
|
+
utc_time.should == (local_time - offset)
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
describe "when manipulating times" do
|
95
|
+
|
96
|
+
it "converts a time to utc based on TimeZone Short Code" do
|
97
|
+
target_zone = "PDT"
|
98
|
+
target_offset = Time.zone_offset("PDT")
|
99
|
+
target_time = Time.now
|
100
|
+
local_time = target_time
|
101
|
+
local_offset = Time.zone_offset(local_time.zone)
|
102
|
+
|
103
|
+
# converting two times (ie 6am PDT and 6am MDT) to UTC should result
|
104
|
+
# in two UTC times that are off by the same offset
|
105
|
+
original_difference = local_offset - target_offset
|
106
|
+
|
107
|
+
target_utc_time = Barometer::Zone.code_to_utc(target_time, target_zone)
|
108
|
+
local_utc_time = local_time.utc
|
109
|
+
|
110
|
+
(target_utc_time - local_time.utc).to_i.should == original_difference.to_i
|
111
|
+
end
|
112
|
+
|
113
|
+
it "merges a date and a time to one utc time (biased by TimeZone Short Code)" do
|
114
|
+
merge_date = "1 March 1990"
|
115
|
+
merge_time = "5:35 am"
|
116
|
+
merge_zonecode = "UTC"
|
117
|
+
|
118
|
+
date = Date.parse(merge_date)
|
119
|
+
time = Time.parse(merge_time)
|
120
|
+
|
121
|
+
utc_time = Barometer::Zone.merge(merge_time, merge_date, merge_zonecode)
|
122
|
+
|
123
|
+
utc_time.year.should == date.year
|
124
|
+
utc_time.month.should == date.month
|
125
|
+
utc_time.day.should == date.day
|
126
|
+
utc_time.hour.should == time.hour
|
127
|
+
utc_time.min.should == time.min
|
128
|
+
utc_time.sec.should == time.sec
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<current_observation> <credit>Weather Underground NOAA Weather Station</credit> <credit_URL>http://wunderground.com/</credit_URL> <image> <url>http://icons.wunderground.com/graphics/wu2/logo_130x80.png</url> <title>Weather Underground</title> <link>http://wunderground.com/</link> </image> <display_location> <full>Calgary, Alberta</full> <city>Calgary</city> <state>AB</state> <state_name>Alberta</state_name> <country>CA</country> <zip>00000</zip> <latitude>51.11999893</latitude> <longitude>-114.01999664</longitude> <elevation> ft</elevation> </display_location> <observation_location> <full>Calgary, </full> <city>Calgary</city> <state></state> <country>CA</country> <latitude>51.11999893</latitude> <longitude>-114.01999664</longitude> <elevation>3556 ft</elevation> </observation_location> <station_id>CYYC</station_id> <observation_time>Last Updated on April 23, 4:00 PM MDT</observation_time> <observation_time_rfc822>Thu, 23 April 2009 22:00:0 GMT</observation_time_rfc822> <weather>Scattered Clouds</weather> <temperature_string>28 F (-2 C)</temperature_string> <temp_f>28</temp_f> <temp_c>-2</temp_c> <relative_humidity>51%</relative_humidity> <wind_string>From the NNW at 13 MPH </wind_string> <wind_dir>NNW</wind_dir> <wind_degrees>340</wind_degrees> <wind_mph>13</wind_mph> <wind_gust_mph></wind_gust_mph> <pressure_string>30.11" (1020 mb)</pressure_string> <pressure_mb>1020</pressure_mb> <pressure_in>30.11</pressure_in> <dewpoint_string>12 F (-11 C)</dewpoint_string> <dewpoint_f>12</dewpoint_f> <dewpoint_c>-11</dewpoint_c> <heat_index_string>NA</heat_index_string> <heat_index_f>NA</heat_index_f> <heat_index_c>NA</heat_index_c> <windchill_string>18 F (-8 C)</windchill_string> <windchill_f>18</windchill_f> <windchill_c>-8</windchill_c> <visibility_mi>20.0</visibility_mi> <visibility_km>32.2</visibility_km> <icon_url_base>http://icons.wunderground.com/graphics/conds/</icon_url_base> <icon_url_name>.GIF</icon_url_name> <icon>partlycloudy</icon> <forecast_url>http://www.wunderground.com/global/stations/71877.html</forecast_url> <history_url>http://www.wunderground.com/history/airport/CYYC/2009/4/23/DailyHistory.html</history_url> <ob_url>http://www.wunderground.com/cgi-bin/findweather/getForecast?query=51.11999893,-114.01999664</ob_url> </current_observation> <!-- 0.050:0 -->
|
@@ -0,0 +1 @@
|
|
1
|
+
<forecast> <txt_forecast> <date></date> <number></number> <forecastday> <period>1</period> <icon>chancesnow</icon> <title>April 23, 2009</title> <fcttext>Chance of Snow. High 0&deg;C (32&deg;F). Winds 21 kph NNW </fcttext> <pop>20</pop> </forecastday> <forecastday> <period>2</period> <icon>chancesnow</icon> <title>April 24, 2009</title> <fcttext>Chance of Snow. High 2&deg;C (35&deg;F). Winds 10 kph NE </fcttext> <pop>20</pop> </forecastday> </txt_forecast> <simpleforecast> <forecastday> <period>1</period> <date> <epoch>1240531200</epoch> <pretty_short>6:00 PM MDT</pretty_short> <pretty>6:00 PM MDT on April 23, 2009</pretty> <day>23</day> <month>4</month> <year>2009</year> <yday>112</yday> <hour>18</hour> <min>00</min> <sec>0</sec> <isdst>1</isdst> <monthname>April</monthname> <weekday_short></weekday_short> <weekday>Thursday</weekday> <ampm>PM</ampm> <tz_short>MDT</tz_short> <tz_long>America/Edmonton</tz_long> </date> <high> <fahrenheit>32</fahrenheit> <celsius>0</celsius> </high> <low> <fahrenheit>22</fahrenheit> <celsius>-5</celsius> </low> <conditions>Chance of Snow</conditions> <icon>chancesnow</icon> <skyicon>cloudy</skyicon> <pop>20</pop> </forecastday> <forecastday> <period>2</period> <date> <epoch>1240617600</epoch> <pretty_short>6:00 PM MDT</pretty_short> <pretty>6:00 PM MDT on April 24, 2009</pretty> <day>24</day> <month>4</month> <year>2009</year> <yday>113</yday> <hour>18</hour> <min>00</min> <sec>0</sec> <isdst>1</isdst> <monthname>April</monthname> <weekday_short></weekday_short> <weekday>Friday</weekday> <ampm>PM</ampm> <tz_short>MDT</tz_short> <tz_long>America/Edmonton</tz_long> </date> <high> <fahrenheit>35</fahrenheit> <celsius>2</celsius> </high> <low> <fahrenheit>28</fahrenheit> <celsius>-2</celsius> </low> <conditions>Chance of Snow</conditions> <icon>chancesnow</icon> <skyicon>partlycloudy</skyicon> <pop>20</pop> </forecastday> <forecastday> <period>3</period> <date> <epoch>1240704000</epoch> <pretty_short>6:00 PM MDT</pretty_short> <pretty>6:00 PM MDT on April 25, 2009</pretty> <day>25</day> <month>4</month> <year>2009</year> <yday>114</yday> <hour>18</hour> <min>00</min> <sec>0</sec> <isdst>1</isdst> <monthname>April</monthname> <weekday_short></weekday_short> <weekday>Saturday</weekday> <ampm>PM</ampm> <tz_short>MDT</tz_short> <tz_long>America/Edmonton</tz_long> </date> <high> <fahrenheit>44</fahrenheit> <celsius>7</celsius> </high> <low> <fahrenheit>30</fahrenheit> <celsius>-1</celsius> </low> <conditions>Chance of Snow</conditions> <icon>chancesnow</icon> <skyicon>cloudy</skyicon> <pop>40</pop> </forecastday> <forecastday> <period>4</period> <date> <epoch>1240790400</epoch> <pretty_short>6:00 PM MDT</pretty_short> <pretty>6:00 PM MDT on April 26, 2009</pretty> <day>26</day> <month>4</month> <year>2009</year> <yday>115</yday> <hour>18</hour> <min>00</min> <sec>0</sec> <isdst>1</isdst> <monthname>April</monthname> <weekday_short></weekday_short> <weekday>Sunday</weekday> <ampm>PM</ampm> <tz_short>MDT</tz_short> <tz_long>America/Edmonton</tz_long> </date> <high> <fahrenheit>33</fahrenheit> <celsius>1</celsius> </high> <low> <fahrenheit>22</fahrenheit> <celsius>-5</celsius> </low> <conditions>Chance of Snow</conditions> <icon>chancesnow</icon> <skyicon>cloudy</skyicon> <pop>30</pop> </forecastday> <forecastday> <period>5</period> <date> <epoch>1240876800</epoch> <pretty_short>6:00 PM MDT</pretty_short> <pretty>6:00 PM MDT on April 27, 2009</pretty> <day>27</day> <month>4</month> <year>2009</year> <yday>116</yday> <hour>18</hour> <min>00</min> <sec>0</sec> <isdst>1</isdst> <monthname>April</monthname> <weekday_short></weekday_short> <weekday>Monday</weekday> <ampm>PM</ampm> <tz_short>MDT</tz_short> <tz_long>America/Edmonton</tz_long> </date> <high> <fahrenheit>35</fahrenheit> <celsius>2</celsius> </high> <low> <fahrenheit>24</fahrenheit> <celsius>-4</celsius> </low> <conditions>Chance of Snow</conditions> <icon>chancesnow</icon> <skyicon>partlycloudy</skyicon> <pop>30</pop> </forecastday> <forecastday> <period>6</period> <date> <epoch>1240963200</epoch> <pretty_short>6:00 PM MDT</pretty_short> <pretty>6:00 PM MDT on April 28, 2009</pretty> <day>28</day> <month>4</month> <year>2009</year> <yday>117</yday> <hour>18</hour> <min>00</min> <sec>0</sec> <isdst>1</isdst> <monthname>April</monthname> <weekday_short></weekday_short> <weekday>Tuesday</weekday> <ampm>PM</ampm> <tz_short>MDT</tz_short> <tz_long>America/Edmonton</tz_long> </date> <high> <fahrenheit>37</fahrenheit> <celsius>3</celsius> </high> <low> <fahrenheit>22</fahrenheit> <celsius>-5</celsius> </low> <conditions>Chance of Snow</conditions> <icon>chancesnow</icon> <skyicon>partlycloudy</skyicon> <pop>30</pop> </forecastday> </simpleforecast> <moon_phase> <percentIlluminated>2</percentIlluminated> <ageOfMoon>28</ageOfMoon> <current_time> <hour>16</hour> <minute>54</minute> </current_time> <sunset> <hour>20</hour> <minute>45</minute> </sunset> <sunrise> <hour>6</hour> <minute>23</minute> </sunrise> </moon_phase> </forecast>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?> <kml xmlns="http://earth.google.com/kml/2.0"><Response> <name>40.756054,-73.986951</name> <Status> <code>200</code> <request>geocode</request> </Status> <Placemark id="p1"> <address>1475 Broadway, New York, NY 10036, USA</address> <AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>NY</AdministrativeAreaName><Locality><LocalityName>New York</LocalityName><Thoroughfare><ThoroughfareName>1475 Broadway</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>10036</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails> <ExtendedData> <LatLonBox north="40.7593486" south="40.7530534" east="-73.9833654" west="-73.9896606" /> </ExtendedData> <Point><coordinates>-73.9865130,40.7562010,0</coordinates></Point> </Placemark> <Placemark id="p2"> <address>Theater District - Times Square, New York, NY, USA</address> <AddressDetails Accuracy="4" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>NY</AdministrativeAreaName><Locality><LocalityName>New York</LocalityName><AddressLine>Theater District - Times Square</AddressLine></Locality></AdministrativeArea></Country></AddressDetails> <ExtendedData> <LatLonBox north="40.7641790" south="40.7537300" east="-73.9790780" west="-73.9908821" /> </ExtendedData> <Point><coordinates>-73.9844722,40.7590110,0</coordinates></Point> </Placemark> <Placemark id="p3"> <address>New York 10036, USA</address> <AddressDetails Accuracy="5" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>NY</AdministrativeAreaName><PostalCode><PostalCodeNumber>10036</PostalCodeNumber></PostalCode></AdministrativeArea></Country></AddressDetails> <ExtendedData> <LatLonBox north="40.7654810" south="40.7534830" east="-73.9781150" west="-74.0016340" /> </ExtendedData> <Point><coordinates>-73.9903489,40.7598450,0</coordinates></Point> </Placemark> <Placemark id="p4"> <address>Midtown, New York, NY, USA</address> <AddressDetails Accuracy="4" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>NY</AdministrativeAreaName><Locality><LocalityName>New York</LocalityName><AddressLine>Midtown</AddressLine></Locality></AdministrativeArea></Country></AddressDetails> <ExtendedData> <LatLonBox north="40.8060980" south="40.7273300" east="-73.9422169" west="-74.0088202" /> </ExtendedData> <Point><coordinates>-73.9771260,40.7690810,0</coordinates></Point> </Placemark> <Placemark id="p5"> <address>Manhattan, New York, USA</address> <AddressDetails Accuracy="4" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>NY</AdministrativeAreaName><AddressLine>Manhattan</AddressLine></AdministrativeArea></Country></AddressDetails> <ExtendedData> <LatLonBox north="40.8820000" south="40.6795170" east="-73.9072000" west="-74.0472500" /> </ExtendedData> <Point><coordinates>-73.9712488,40.7830603,0</coordinates></Point> </Placemark> <Placemark id="p6"> <address>New York, New York, USA</address> <AddressDetails Accuracy="3" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>NY</AdministrativeAreaName><AddressLine>New York</AddressLine></AdministrativeArea></Country></AddressDetails> <ExtendedData> <LatLonBox north="40.8820000" south="40.6795170" east="-73.9072000" west="-74.0472500" /> </ExtendedData> <Point><coordinates>-73.9712488,40.7830603,0</coordinates></Point> </Placemark> <Placemark id="p7"> <address>New York, NY, USA</address> <AddressDetails Accuracy="4" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>NY</AdministrativeAreaName><Locality><LocalityName>New York</LocalityName></Locality></AdministrativeArea></Country></AddressDetails> <ExtendedData> <LatLonBox north="40.9174990" south="40.4773830" east="-73.6997930" west="-74.2590900" /> </ExtendedData> <Point><coordinates>-73.9869510,40.7560540,0</coordinates></Point> </Placemark> <Placemark id="p8"> <address>New York, USA</address> <AddressDetails Accuracy="2" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>NY</AdministrativeAreaName></AdministrativeArea></Country></AddressDetails> <ExtendedData> <LatLonBox north="45.0158510" south="40.4773830" east="-71.7774920" west="-79.7625900" /> </ExtendedData> <Point><coordinates>-74.2179326,43.2994285,0</coordinates></Point> </Placemark> <Placemark id="p9"> <address>United States</address> <AddressDetails Accuracy="1" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName></Country></AddressDetails> <ExtendedData> <LatLonBox north="71.4343570" south="17.8315100" east="-65.1685040" west="172.3478480" /> </ExtendedData> <Point><coordinates>-95.7128910,37.0902400,0</coordinates></Point> </Placemark> </Response></kml>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?> <kml xmlns="http://earth.google.com/kml/2.0"><Response> <name>90210</name> <Status> <code>200</code> <request>geocode</request> </Status> <Placemark id="p1"> <address>Beverly Hills, CA 90210, USA</address> <AddressDetails Accuracy="5" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>CA</AdministrativeAreaName><Locality><LocalityName>Beverly Hills</LocalityName><PostalCode><PostalCodeNumber>90210</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails> <ExtendedData> <LatLonBox north="34.1391900" south="34.0670180" east="-118.3897100" west="-118.4427960" /> </ExtendedData> <Point><coordinates>-118.4104684,34.1030032,0</coordinates></Point> </Placemark> </Response></kml>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?> <kml xmlns="http://earth.google.com/kml/2.0"><Response> <name>T5B 4M9</name> <Status> <code>200</code> <request>geocode</request> </Status> <Placemark id="p1"> <address>Alberta T5B 4M9, Canada</address> <AddressDetails Accuracy="5" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>CA</CountryNameCode><CountryName>Canada</CountryName><AdministrativeArea><AdministrativeAreaName>AB</AdministrativeAreaName><PostalCode><PostalCodeNumber>T5B 4M9</PostalCodeNumber></PostalCode></AdministrativeArea></Country></AddressDetails> <ExtendedData> <LatLonBox north="53.5735946" south="53.5672994" east="-113.4529354" west="-113.4592306" /> </ExtendedData> <Point><coordinates>-113.4560830,53.5704470,0</coordinates></Point> </Placemark> </Response></kml>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?> <kml xmlns="http://earth.google.com/kml/2.0"><Response> <name>Calgary,AB</name> <Status> <code>200</code> <request>geocode</request> </Status> <Placemark id="p1"> <address>Calgary, AB, Canada</address> <AddressDetails Accuracy="4" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>CA</CountryNameCode><CountryName>Canada</CountryName><AdministrativeArea><AdministrativeAreaName>AB</AdministrativeAreaName><Locality><LocalityName>Calgary</LocalityName></Locality></AdministrativeArea></Country></AddressDetails> <ExtendedData> <LatLonBox north="51.1838270" south="50.8417840" east="-113.9057040" west="-114.2713780" /> </ExtendedData> <Point><coordinates>-114.0624380,51.0551490,0</coordinates></Point> </Placemark> </Response></kml>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?> <kml xmlns="http://earth.google.com/kml/2.0"><Response> <name>New York, NY</name> <Status> <code>200</code> <request>geocode</request> </Status> <Placemark id="p1"> <address>New York, NY, USA</address> <AddressDetails Accuracy="4" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>NY</AdministrativeAreaName><Locality><LocalityName>New York</LocalityName></Locality></AdministrativeArea></Country></AddressDetails> <ExtendedData> <LatLonBox north="40.9174990" south="40.4773830" east="-73.6997930" west="-74.2590900" /> </ExtendedData> <Point><coordinates>-73.9869510,40.7560540,0</coordinates></Point> </Placemark> </Response></kml>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?xml version="1.0"?><xml_api_reply version="1"><weather module_id="0" tab_id="0" mobile_row="0" mobile_zipped="1" row="0" section="0" ><forecast_information><city data="Calgary, AB"/><postal_code data="Calgary,AB"/><latitude_e6 data=""/><longitude_e6 data=""/><forecast_date data="2009-04-26"/><current_date_time data="2009-04-26 15:14:15 +0000"/><unit_system data="US"/></forecast_information><current_conditions><condition data="Cloudy"/><temp_f data="32"/><temp_c data="0"/><humidity data="Humidity: 64%"/><icon data="/images/weather/cloudy.gif"/><wind_condition data="Wind: NW at 5 mph"/></current_conditions><forecast_conditions><day_of_week data="Sun"/><low data="24"/><high data="42"/><icon data="/images/weather/rain.gif"/><condition data="Sleet"/></forecast_conditions><forecast_conditions><day_of_week data="Mon"/><low data="22"/><high data="37"/><icon data="/images/weather/rain.gif"/><condition data="Sleet"/></forecast_conditions><forecast_conditions><day_of_week data="Tue"/><low data="24"/><high data="40"/><icon data="/images/weather/rain.gif"/><condition data="Sleet"/></forecast_conditions><forecast_conditions><day_of_week data="Wed"/><low data="21"/><high data="43"/><icon data="/images/weather/mostly_cloudy.gif"/><condition data="Mostly Cloudy"/></forecast_conditions></weather></xml_api_reply>
|