barometer 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/VERSION.yml +1 -1
- data/barometer.gemspec +1 -1
- data/bin/barometer +2 -2
- data/lib/barometer.rb +7 -0
- data/lib/barometer/data/geo.rb +28 -41
- data/lib/barometer/weather_services/weather_bug.rb +1 -1
- data/lib/barometer/web_services/geocode.rb +16 -9
- data/spec/barometer_spec.rb +12 -0
- data/spec/fakeweb_helper.rb +40 -39
- data/spec/fixtures/geocode/40_73_v3.json +497 -0
- data/spec/fixtures/geocode/90210_v3.json +63 -0
- data/spec/fixtures/geocode/T5B4M9_v3.json +68 -0
- data/spec/fixtures/geocode/atlanta_v3.json +58 -0
- data/spec/fixtures/geocode/calgary_ab_v3.json +58 -0
- data/spec/fixtures/geocode/ksfo_v3.json +73 -0
- data/spec/fixtures/geocode/newyork_ny_v3.json +58 -0
- data/spec/fixtures/services/weather_bug/90210_current.xml +93 -1
- data/spec/fixtures/services/weather_bug/90210_forecast.xml +76 -1
- data/spec/formats/coordinates_spec.rb +1 -1
- data/spec/formats/geocode_spec.rb +5 -5
- data/spec/query_spec.rb +4 -4
- data/spec/weather_services/weather_bug_spec.rb +24 -24
- metadata +16 -16
- data/spec/fixtures/geocode/40_73.json +0 -41
- data/spec/fixtures/geocode/90210.json +0 -38
- data/spec/fixtures/geocode/T5B4M9.json +0 -38
- data/spec/fixtures/geocode/atlanta.json +0 -38
- data/spec/fixtures/geocode/calgary_ab.json +0 -38
- data/spec/fixtures/geocode/ksfo.json +0 -42
- data/spec/fixtures/geocode/newyork_ny.json +0 -38
@@ -0,0 +1,63 @@
|
|
1
|
+
{
|
2
|
+
"results" : [
|
3
|
+
{
|
4
|
+
"address_components" : [
|
5
|
+
{
|
6
|
+
"long_name" : "90210",
|
7
|
+
"short_name" : "90210",
|
8
|
+
"types" : [ "postal_code" ]
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"long_name" : "Beverly Hills",
|
12
|
+
"short_name" : "Beverly Hills",
|
13
|
+
"types" : [ "locality", "political" ]
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"long_name" : "Los Angeles",
|
17
|
+
"short_name" : "Los Angeles",
|
18
|
+
"types" : [ "administrative_area_level_2", "political" ]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"long_name" : "California",
|
22
|
+
"short_name" : "CA",
|
23
|
+
"types" : [ "administrative_area_level_1", "political" ]
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"long_name" : "United States",
|
27
|
+
"short_name" : "US",
|
28
|
+
"types" : [ "country", "political" ]
|
29
|
+
}
|
30
|
+
],
|
31
|
+
"formatted_address" : "Beverly Hills, CA 90210, USA",
|
32
|
+
"geometry" : {
|
33
|
+
"bounds" : {
|
34
|
+
"northeast" : {
|
35
|
+
"lat" : 34.13775590,
|
36
|
+
"lng" : -118.3896720
|
37
|
+
},
|
38
|
+
"southwest" : {
|
39
|
+
"lat" : 34.0642330,
|
40
|
+
"lng" : -118.4467160
|
41
|
+
}
|
42
|
+
},
|
43
|
+
"location" : {
|
44
|
+
"lat" : 34.10300320,
|
45
|
+
"lng" : -118.41046840
|
46
|
+
},
|
47
|
+
"location_type" : "APPROXIMATE",
|
48
|
+
"viewport" : {
|
49
|
+
"northeast" : {
|
50
|
+
"lat" : 34.13775590,
|
51
|
+
"lng" : -118.3896720
|
52
|
+
},
|
53
|
+
"southwest" : {
|
54
|
+
"lat" : 34.0642330,
|
55
|
+
"lng" : -118.4467160
|
56
|
+
}
|
57
|
+
}
|
58
|
+
},
|
59
|
+
"types" : [ "postal_code" ]
|
60
|
+
}
|
61
|
+
],
|
62
|
+
"status" : "OK"
|
63
|
+
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
{
|
2
|
+
"results" : [
|
3
|
+
{
|
4
|
+
"address_components" : [
|
5
|
+
{
|
6
|
+
"long_name" : "T5B 4M9",
|
7
|
+
"short_name" : "T5B 4M9",
|
8
|
+
"types" : [ "postal_code" ]
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"long_name" : "Montrose",
|
12
|
+
"short_name" : "Montrose",
|
13
|
+
"types" : [ "sublocality", "political" ]
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"long_name" : "Edmonton",
|
17
|
+
"short_name" : "Edmonton",
|
18
|
+
"types" : [ "locality", "political" ]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"long_name" : "Division No. 11",
|
22
|
+
"short_name" : "Division No. 11",
|
23
|
+
"types" : [ "administrative_area_level_2", "political" ]
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"long_name" : "Alberta",
|
27
|
+
"short_name" : "AB",
|
28
|
+
"types" : [ "administrative_area_level_1", "political" ]
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"long_name" : "Canada",
|
32
|
+
"short_name" : "CA",
|
33
|
+
"types" : [ "country", "political" ]
|
34
|
+
}
|
35
|
+
],
|
36
|
+
"formatted_address" : "Edmonton, AB T5B 4M9, Canada",
|
37
|
+
"geometry" : {
|
38
|
+
"bounds" : {
|
39
|
+
"northeast" : {
|
40
|
+
"lat" : 53.57536850,
|
41
|
+
"lng" : -113.4531120
|
42
|
+
},
|
43
|
+
"southwest" : {
|
44
|
+
"lat" : 53.57041430,
|
45
|
+
"lng" : -113.45893970
|
46
|
+
}
|
47
|
+
},
|
48
|
+
"location" : {
|
49
|
+
"lat" : 53.5705160,
|
50
|
+
"lng" : -113.457840
|
51
|
+
},
|
52
|
+
"location_type" : "APPROXIMATE",
|
53
|
+
"viewport" : {
|
54
|
+
"northeast" : {
|
55
|
+
"lat" : 53.57603902068017,
|
56
|
+
"lng" : -113.4528782293198
|
57
|
+
},
|
58
|
+
"southwest" : {
|
59
|
+
"lat" : 53.56974377931983,
|
60
|
+
"lng" : -113.4591734706802
|
61
|
+
}
|
62
|
+
}
|
63
|
+
},
|
64
|
+
"types" : [ "postal_code" ]
|
65
|
+
}
|
66
|
+
],
|
67
|
+
"status" : "OK"
|
68
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
{
|
2
|
+
"results" : [
|
3
|
+
{
|
4
|
+
"address_components" : [
|
5
|
+
{
|
6
|
+
"long_name" : "Atlanta",
|
7
|
+
"short_name" : "Atlanta",
|
8
|
+
"types" : [ "locality", "political" ]
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"long_name" : "Fulton",
|
12
|
+
"short_name" : "Fulton",
|
13
|
+
"types" : [ "administrative_area_level_2", "political" ]
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"long_name" : "Georgia",
|
17
|
+
"short_name" : "GA",
|
18
|
+
"types" : [ "administrative_area_level_1", "political" ]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"long_name" : "United States",
|
22
|
+
"short_name" : "US",
|
23
|
+
"types" : [ "country", "political" ]
|
24
|
+
}
|
25
|
+
],
|
26
|
+
"formatted_address" : "Atlanta, GA, USA",
|
27
|
+
"geometry" : {
|
28
|
+
"bounds" : {
|
29
|
+
"northeast" : {
|
30
|
+
"lat" : 33.88761790,
|
31
|
+
"lng" : -84.2893890
|
32
|
+
},
|
33
|
+
"southwest" : {
|
34
|
+
"lat" : 33.6478080,
|
35
|
+
"lng" : -84.55181899999999
|
36
|
+
}
|
37
|
+
},
|
38
|
+
"location" : {
|
39
|
+
"lat" : 33.74899540,
|
40
|
+
"lng" : -84.38798240
|
41
|
+
},
|
42
|
+
"location_type" : "APPROXIMATE",
|
43
|
+
"viewport" : {
|
44
|
+
"northeast" : {
|
45
|
+
"lat" : 33.82318440,
|
46
|
+
"lng" : -84.2599230
|
47
|
+
},
|
48
|
+
"southwest" : {
|
49
|
+
"lat" : 33.67474220,
|
50
|
+
"lng" : -84.51604180
|
51
|
+
}
|
52
|
+
}
|
53
|
+
},
|
54
|
+
"types" : [ "locality", "political" ]
|
55
|
+
}
|
56
|
+
],
|
57
|
+
"status" : "OK"
|
58
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
{
|
2
|
+
"results" : [
|
3
|
+
{
|
4
|
+
"address_components" : [
|
5
|
+
{
|
6
|
+
"long_name" : "Calgary",
|
7
|
+
"short_name" : "Calgary",
|
8
|
+
"types" : [ "locality", "political" ]
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"long_name" : "Division No. 6",
|
12
|
+
"short_name" : "Division No. 6",
|
13
|
+
"types" : [ "administrative_area_level_2", "political" ]
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"long_name" : "Alberta",
|
17
|
+
"short_name" : "AB",
|
18
|
+
"types" : [ "administrative_area_level_1", "political" ]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"long_name" : "Canada",
|
22
|
+
"short_name" : "CA",
|
23
|
+
"types" : [ "country", "political" ]
|
24
|
+
}
|
25
|
+
],
|
26
|
+
"formatted_address" : "Calgary, AB, Canada",
|
27
|
+
"geometry" : {
|
28
|
+
"bounds" : {
|
29
|
+
"northeast" : {
|
30
|
+
"lat" : 51.183830,
|
31
|
+
"lng" : -113.9056380
|
32
|
+
},
|
33
|
+
"southwest" : {
|
34
|
+
"lat" : 50.84240399999999,
|
35
|
+
"lng" : -114.271360
|
36
|
+
}
|
37
|
+
},
|
38
|
+
"location" : {
|
39
|
+
"lat" : 51.04499999999999,
|
40
|
+
"lng" : -114.05722220
|
41
|
+
},
|
42
|
+
"location_type" : "APPROXIMATE",
|
43
|
+
"viewport" : {
|
44
|
+
"northeast" : {
|
45
|
+
"lat" : 51.15710630,
|
46
|
+
"lng" : -113.80110340
|
47
|
+
},
|
48
|
+
"southwest" : {
|
49
|
+
"lat" : 50.93262180,
|
50
|
+
"lng" : -114.3133410
|
51
|
+
}
|
52
|
+
}
|
53
|
+
},
|
54
|
+
"types" : [ "locality", "political" ]
|
55
|
+
}
|
56
|
+
],
|
57
|
+
"status" : "OK"
|
58
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
{
|
2
|
+
"results" : [
|
3
|
+
{
|
4
|
+
"address_components" : [
|
5
|
+
{
|
6
|
+
"long_name" : "San Francisco International Airport",
|
7
|
+
"short_name" : "SFO",
|
8
|
+
"types" : [ "establishment" ]
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"long_name" : "San Francisco",
|
12
|
+
"short_name" : "SF",
|
13
|
+
"types" : [ "locality", "political" ]
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"long_name" : "South San Francisco",
|
17
|
+
"short_name" : "South San Francisco",
|
18
|
+
"types" : [ "administrative_area_level_3", "political" ]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"long_name" : "San Mateo",
|
22
|
+
"short_name" : "San Mateo",
|
23
|
+
"types" : [ "administrative_area_level_2", "political" ]
|
24
|
+
},
|
25
|
+
{
|
26
|
+
"long_name" : "California",
|
27
|
+
"short_name" : "CA",
|
28
|
+
"types" : [ "administrative_area_level_1", "political" ]
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"long_name" : "United States",
|
32
|
+
"short_name" : "US",
|
33
|
+
"types" : [ "country", "political" ]
|
34
|
+
},
|
35
|
+
{
|
36
|
+
"long_name" : "94128",
|
37
|
+
"short_name" : "94128",
|
38
|
+
"types" : [ "postal_code" ]
|
39
|
+
}
|
40
|
+
],
|
41
|
+
"formatted_address" : "San Francisco International Airport, San Francisco, CA 94128, USA",
|
42
|
+
"geometry" : {
|
43
|
+
"bounds" : {
|
44
|
+
"northeast" : {
|
45
|
+
"lat" : 37.63921040,
|
46
|
+
"lng" : -122.35491660
|
47
|
+
},
|
48
|
+
"southwest" : {
|
49
|
+
"lat" : 37.60437690,
|
50
|
+
"lng" : -122.40141080
|
51
|
+
}
|
52
|
+
},
|
53
|
+
"location" : {
|
54
|
+
"lat" : 37.6152230,
|
55
|
+
"lng" : -122.3899790
|
56
|
+
},
|
57
|
+
"location_type" : "APPROXIMATE",
|
58
|
+
"viewport" : {
|
59
|
+
"northeast" : {
|
60
|
+
"lat" : 37.6328980,
|
61
|
+
"lng" : -122.35796420
|
62
|
+
},
|
63
|
+
"southwest" : {
|
64
|
+
"lat" : 37.59754380,
|
65
|
+
"lng" : -122.42199380
|
66
|
+
}
|
67
|
+
}
|
68
|
+
},
|
69
|
+
"types" : [ "airport", "airport", "establishment" ]
|
70
|
+
}
|
71
|
+
],
|
72
|
+
"status" : "OK"
|
73
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
{
|
2
|
+
"results" : [
|
3
|
+
{
|
4
|
+
"address_components" : [
|
5
|
+
{
|
6
|
+
"long_name" : "New York",
|
7
|
+
"short_name" : "New York",
|
8
|
+
"types" : [ "locality", "political" ]
|
9
|
+
},
|
10
|
+
{
|
11
|
+
"long_name" : "New York",
|
12
|
+
"short_name" : "New York",
|
13
|
+
"types" : [ "administrative_area_level_2", "political" ]
|
14
|
+
},
|
15
|
+
{
|
16
|
+
"long_name" : "New York",
|
17
|
+
"short_name" : "NY",
|
18
|
+
"types" : [ "administrative_area_level_1", "political" ]
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"long_name" : "United States",
|
22
|
+
"short_name" : "US",
|
23
|
+
"types" : [ "country", "political" ]
|
24
|
+
}
|
25
|
+
],
|
26
|
+
"formatted_address" : "New York, NY, USA",
|
27
|
+
"geometry" : {
|
28
|
+
"bounds" : {
|
29
|
+
"northeast" : {
|
30
|
+
"lat" : 40.9175770,
|
31
|
+
"lng" : -73.7002720
|
32
|
+
},
|
33
|
+
"southwest" : {
|
34
|
+
"lat" : 40.4773990,
|
35
|
+
"lng" : -74.259090
|
36
|
+
}
|
37
|
+
},
|
38
|
+
"location" : {
|
39
|
+
"lat" : 40.71435280,
|
40
|
+
"lng" : -74.00597309999999
|
41
|
+
},
|
42
|
+
"location_type" : "APPROXIMATE",
|
43
|
+
"viewport" : {
|
44
|
+
"northeast" : {
|
45
|
+
"lat" : 40.84953420,
|
46
|
+
"lng" : -73.74985430
|
47
|
+
},
|
48
|
+
"southwest" : {
|
49
|
+
"lat" : 40.57889640,
|
50
|
+
"lng" : -74.26209190
|
51
|
+
}
|
52
|
+
}
|
53
|
+
},
|
54
|
+
"types" : [ "locality", "political" ]
|
55
|
+
}
|
56
|
+
],
|
57
|
+
"status" : "OK"
|
58
|
+
}
|
@@ -1 +1,93 @@
|
|
1
|
-
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<aws:weather xmlns:aws="http://www.aws.com/aws">
|
3
|
+
<aws:api version="2.0"/>
|
4
|
+
<aws:WebURL>http://weather.weatherbug.com/CA/Los Angeles-weather.html?ZCode=Z5546&Units=1&stat=LSNGN</aws:WebURL>
|
5
|
+
<aws:InputLocationURL>http://weather.weatherbug.com/CA/Beverly Hills-weather.html?ZCode=Z5546&Units=1</aws:InputLocationURL>
|
6
|
+
<aws:ob>
|
7
|
+
<aws:ob-date>
|
8
|
+
<aws:year number="2011"/>
|
9
|
+
<aws:month number="6" text="June" abbrv="Jun"/>
|
10
|
+
<aws:day number="2" text="Thursday" abbrv="Thu"/>
|
11
|
+
<aws:hour number="7" hour-24="07"/>
|
12
|
+
<aws:minute number="01"/>
|
13
|
+
<aws:second number="00"/>
|
14
|
+
<aws:am-pm abbrv="AM"/>
|
15
|
+
<aws:time-zone offset="-7" text="Pacific Daylight Time (USA)" abbrv="PDT"/>
|
16
|
+
</aws:ob-date>
|
17
|
+
<aws:requested-station-id/>
|
18
|
+
<aws:station-id>LSNGN</aws:station-id>
|
19
|
+
<aws:station>Alexander Hamilton Senior HS</aws:station>
|
20
|
+
<aws:city-state zipcode="90034">Los Angeles, CA</aws:city-state>
|
21
|
+
<aws:country>USA</aws:country>
|
22
|
+
<aws:latitude>34.0336112976074</aws:latitude>
|
23
|
+
<aws:longitude>-118.389999389648</aws:longitude>
|
24
|
+
<aws:site-url>http://www.hamiltonhighschool.net/</aws:site-url>
|
25
|
+
<aws:aux-temp units="&deg;C">17</aws:aux-temp>
|
26
|
+
<aws:aux-temp-rate units="&deg;C">-0.5</aws:aux-temp-rate>
|
27
|
+
<aws:current-condition icon="http://deskwx.weatherbug.com/images/Forecast/icons/cond007.gif">Sunny</aws:current-condition>
|
28
|
+
<aws:dew-point units="&deg;C">10</aws:dew-point>
|
29
|
+
<aws:elevation units="m">40</aws:elevation>
|
30
|
+
<aws:feels-like units="&deg;C">14</aws:feels-like>
|
31
|
+
<aws:gust-time>
|
32
|
+
<aws:year number="2011"/>
|
33
|
+
<aws:month number="6" text="June" abbrv="Jun"/>
|
34
|
+
<aws:day number="2" text="Thursday" abbrv="Thu"/>
|
35
|
+
<aws:hour number="12" hour-24="00"/>
|
36
|
+
<aws:minute number="43"/>
|
37
|
+
<aws:second number="00"/>
|
38
|
+
<aws:am-pm abbrv="AM"/>
|
39
|
+
<aws:time-zone offset="-7" text="Pacific Daylight Time (USA)" abbrv="PDT"/>
|
40
|
+
</aws:gust-time>
|
41
|
+
<aws:gust-direction>SE</aws:gust-direction>
|
42
|
+
<aws:gust-direction-degrees>130</aws:gust-direction-degrees>
|
43
|
+
<aws:gust-speed units="km/h">6</aws:gust-speed>
|
44
|
+
<aws:humidity units="%">79</aws:humidity>
|
45
|
+
<aws:humidity-high units="%">91</aws:humidity-high>
|
46
|
+
<aws:humidity-low units="%">79</aws:humidity-low>
|
47
|
+
<aws:humidity-rate>-6</aws:humidity-rate>
|
48
|
+
<aws:indoor-temp units="&deg;C">23</aws:indoor-temp>
|
49
|
+
<aws:indoor-temp-rate units="&deg;C">0</aws:indoor-temp-rate>
|
50
|
+
<aws:light>4.3</aws:light>
|
51
|
+
<aws:light-rate>4.2</aws:light-rate>
|
52
|
+
<aws:moon-phase moon-phase-img="http://api.wxbug.net/images/moonphase/mphase01.gif">0</aws:moon-phase>
|
53
|
+
<aws:pressure units="mb">1017.61</aws:pressure>
|
54
|
+
<aws:pressure-high units="mb">1017.61</aws:pressure-high>
|
55
|
+
<aws:pressure-low units="mb">1016.26</aws:pressure-low>
|
56
|
+
<aws:pressure-rate units="mb/h">0.34</aws:pressure-rate>
|
57
|
+
<aws:rain-month units="mm">0.00</aws:rain-month>
|
58
|
+
<aws:rain-rate units="mm/h">0.00</aws:rain-rate>
|
59
|
+
<aws:rain-rate-max units="mm/h">0.00</aws:rain-rate-max>
|
60
|
+
<aws:rain-today units="mm">0.00</aws:rain-today>
|
61
|
+
<aws:rain-year units="mm">158.50</aws:rain-year>
|
62
|
+
<aws:temp units="&deg;C">13.6</aws:temp>
|
63
|
+
<aws:temp-high units="&deg;C">14</aws:temp-high>
|
64
|
+
<aws:temp-low units="&deg;C">12</aws:temp-low>
|
65
|
+
<aws:temp-rate units="&deg;C/h">1.4</aws:temp-rate>
|
66
|
+
<aws:sunrise>
|
67
|
+
<aws:year number="2011"/>
|
68
|
+
<aws:month number="6" text="June" abbrv="Jun"/>
|
69
|
+
<aws:day number="2" text="Thursday" abbrv="Thu"/>
|
70
|
+
<aws:hour number="5" hour-24="05"/>
|
71
|
+
<aws:minute number="42"/>
|
72
|
+
<aws:second number="59"/>
|
73
|
+
<aws:am-pm abbrv="AM"/>
|
74
|
+
<aws:time-zone offset="-7" text="Pacific Daylight Time (USA)" abbrv="PDT"/>
|
75
|
+
</aws:sunrise>
|
76
|
+
<aws:sunset>
|
77
|
+
<aws:year number="2011"/>
|
78
|
+
<aws:month number="6" text="June" abbrv="Jun"/>
|
79
|
+
<aws:day number="2" text="Thursday" abbrv="Thu"/>
|
80
|
+
<aws:hour number="8" hour-24="20"/>
|
81
|
+
<aws:minute number="00"/>
|
82
|
+
<aws:second number="17"/>
|
83
|
+
<aws:am-pm abbrv="PM"/>
|
84
|
+
<aws:time-zone offset="-7" text="Pacific Daylight Time (USA)" abbrv="PDT"/>
|
85
|
+
</aws:sunset>
|
86
|
+
<aws:wet-bulb units="&deg;C">11.7</aws:wet-bulb>
|
87
|
+
<aws:wind-speed units="km/h">0</aws:wind-speed>
|
88
|
+
<aws:wind-speed-avg units="km/h">2</aws:wind-speed-avg>
|
89
|
+
<aws:wind-direction>SE</aws:wind-direction>
|
90
|
+
<aws:wind-direction-degrees>130</aws:wind-direction-degrees>
|
91
|
+
<aws:wind-direction-avg>SE</aws:wind-direction-avg>
|
92
|
+
</aws:ob>
|
93
|
+
</aws:weather>
|