barometer 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +8 -23
- data/TODO +4 -2
- data/VERSION.yml +1 -1
- data/barometer.gemspec +2 -2
- data/bin/barometer +2 -20
- data/lib/barometer.rb +0 -4
- data/lib/barometer/data/geo.rb +14 -11
- data/lib/barometer/weather_services/google.rb +1 -1
- data/lib/barometer/web_services/geocode.rb +4 -9
- data/lib/barometer/web_services/placemaker.rb +2 -0
- data/spec/barometer_spec.rb +0 -10
- data/spec/fakeweb_helper.rb +50 -30
- data/spec/fixtures/formats/weather_id/90210.xml +7 -1
- data/spec/fixtures/formats/weather_id/from_USGA0028.xml +3 -1
- data/spec/fixtures/formats/weather_id/ksfo.xml +1 -1
- data/spec/fixtures/formats/weather_id/manhattan.xml +7 -0
- data/spec/fixtures/formats/weather_id/new_york.xml +1 -1
- data/spec/fixtures/formats/weather_id/the_hills.xml +1 -0
- data/spec/fixtures/geocode/40_73.json +10 -142
- data/spec/fixtures/geocode/90210.json +9 -12
- data/spec/fixtures/geocode/T5B4M9.json +11 -8
- data/spec/fixtures/geocode/atlanta.json +1 -1
- data/spec/fixtures/geocode/calgary_ab.json +6 -6
- data/spec/fixtures/geocode/ksfo.json +14 -14
- data/spec/fixtures/geocode/newyork_ny.json +5 -5
- data/spec/fixtures/services/google/calgary_ab.xml +1 -1
- data/spec/fixtures/services/placemaker/w615702.xml +40 -39
- data/spec/fixtures/services/weather_dot_com/90210.xml +1 -1
- data/spec/fixtures/services/wunderground/current_calgary_ab.xml +9 -1
- data/spec/fixtures/services/wunderground/forecast_calgary_ab.xml +13 -1
- data/spec/fixtures/services/yahoo/90210.xml +3 -1
- data/spec/formats/coordinates_spec.rb +3 -11
- data/spec/formats/geocode_spec.rb +33 -41
- data/spec/formats/weather_id_spec.rb +0 -4
- data/spec/formats/woe_id_spec.rb +0 -4
- data/spec/query_spec.rb +4 -23
- data/spec/spec_helper.rb +0 -1
- data/spec/weather_services/weather_dot_com_spec.rb +32 -32
- data/spec/weather_services/wunderground_spec.rb +2 -2
- data/spec/weather_services/yahoo_spec.rb +10 -22
- data/spec/web_services/geocode_spec.rb +1 -11
- metadata +7 -19
- data/spec/fixtures/formats/weather_id/atlanta.xml +0 -1
- data/spec/fixtures/geocode/40_73.xml +0 -1
- data/spec/fixtures/geocode/90210.xml +0 -1
- data/spec/fixtures/geocode/T5B4M9.xml +0 -1
- data/spec/fixtures/geocode/atlanta.xml +0 -1
- data/spec/fixtures/geocode/calgary_ab.xml +0 -1
- data/spec/fixtures/geocode/ksfo.xml +0 -1
- data/spec/fixtures/geocode/newyork_ny.xml +0 -1
@@ -1 +1 @@
|
|
1
|
-
<?xml version="1.0" encoding="
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?> <!-- This document is intended only for use by authorized licensees of The --> <!-- Weather Channel. Unauthorized use is prohibited. Copyright 1995-2011, --> <!-- The Weather Channel Interactive, Inc. All Rights Reserved. --> <weather ver="2.0"> <head> <locale>en_US</locale> <form>MEDIUM</form> <ut>C</ut> <ud>km</ud> <us>km/h</us> <up>mb</up> <ur>mm</ur> </head> <loc id="90210"> <dnam>Beverly Hills, CA (90210)</dnam> <tm>3:32 PM</tm> <lat>34.10</lat> <lon>-118.41</lon> <sunr>5:43 AM</sunr> <suns>8:00 PM</suns> <zone>-7</zone> </loc> <lnks type="prmo"> <link pos="1"> <l>http://www.weather.com/allergies?par=xoap&site=textlink&cm_ven=XOAP&cm_cat=TextLink&cm_pla=Link1&cm_ite=Allergies</l> <t>Local Pollen Reports</t> </link> <link pos="2"> <l>http://www.weather.com/flights?par=xoap&site=textlink&cm_ven=XOAP&cm_cat=TextLink&cm_pla=Link2&cm_ite=BusinessTraveler</l> <t>Airport Conditions</t> </link> <link pos="3"> <l>http://www.weather.com/garden?par=xoap&site=textlink&cm_ven=XOAP&cm_cat=TextLink&cm_pla=Link3&cm_ite=Garden</l> <t>Lawn and Garden Weather</t> </link> <link pos="4"> <l>http://www.weather.com/traffic?par=xoap&site=textlink&cm_ven=XOAP&cm_cat=TextLink&cm_pla=Link4&cm_ite=Traffic</l> <t>Rush Hour Traffic</t> </link> </lnks> <cc> <lsup>6/1/11 2:51 PM PDT</lsup> <obst>Santa Monica, CA</obst> <tmp>17</tmp> <flik>17</flik> <t>Fair</t> <icon>34</icon> <bar> <r>1017.9</r> <d>falling</d> </bar> <wind> <s>14</s> <gust>N/A</gust> <d>230</d> <t>SW</t> </wind> <hmid>65</hmid> <vis>16.1</vis> <uv> <i>8</i> <t>Very High</t> </uv> <dewp>10</dewp> <moon> <icon>0</icon> <t>New</t> </moon> </cc> <dayf> <lsup>6/1/11 2:09 PM PDT</lsup> <day d="0" t="Wednesday" dt="Jun 1"> <hi>N/A</hi> <low>12</low> <sunr>5:43 AM</sunr> <suns>8:00 PM</suns> <part p="d"> <icon>44</icon> <t>N/A</t> <wind> <s>N/A</s> <gust>N/A</gust> <d>N/A</d> <t>N/A</t> </wind> <bt>N/A</bt> <ppcp>0</ppcp> <hmid>N/A</hmid> </part> <part p="n"> <icon>31</icon> <t>Clear</t> <wind> <s>16</s> <gust>N/A</gust> <d>343</d> <t>NNW</t> </wind> <bt>Clear</bt> <ppcp>0</ppcp> <hmid>62</hmid> </part> </day> <day d="1" t="Thursday" dt="Jun 2"> <hi>23</hi> <low>12</low> <sunr>5:43 AM</sunr> <suns>8:01 PM</suns> <part p="d"> <icon>34</icon> <t>Mostly Sunny</t> <wind> <s>21</s> <gust>N/A</gust> <d>215</d> <t>SW</t> </wind> <bt>M Sunny</bt> <ppcp>0</ppcp> <hmid>42</hmid> </part> <part p="n"> <icon>31</icon> <t>Clear</t> <wind> <s>16</s> <gust>N/A</gust> <d>357</d> <t>N</t> </wind> <bt>Clear</bt> <ppcp>0</ppcp> <hmid>53</hmid> </part> </day> <day d="2" t="Friday" dt="Jun 3"> <hi>24</hi> <low>13</low> <sunr>5:43 AM</sunr> <suns>8:01 PM</suns> <part p="d"> <icon>32</icon> <t>Sunny</t> <wind> <s>16</s> <gust>N/A</gust> <d>181</d> <t>S</t> </wind> <bt>Sunny</bt> <ppcp>0</ppcp> <hmid>36</hmid> </part> <part p="n"> <icon>29</icon> <t>Partly Cloudy</t> <wind> <s>8</s> <gust>N/A</gust> <d>184</d> <t>S</t> </wind> <bt>P Cloudy</bt> <ppcp>20</ppcp> <hmid>55</hmid> </part> </day> <day d="3" t="Saturday" dt="Jun 4"> <hi>20</hi> <low>13</low> <sunr>5:43 AM</sunr> <suns>8:02 PM</suns> <part p="d"> <icon>30</icon> <t>Partly Cloudy</t> <wind> <s>14</s> <gust>N/A</gust> <d>180</d> <t>S</t> </wind> <bt>P Cloudy</bt> <ppcp>20</ppcp> <hmid>59</hmid> </part> <part p="n"> <icon>33</icon> <t>Mostly Clear</t> <wind> <s>6</s> <gust>N/A</gust> <d>217</d> <t>SW</t> </wind> <bt>M Clear</bt> <ppcp>0</ppcp> <hmid>67</hmid> </part> </day> <day d="4" t="Sunday" dt="Jun 5"> <hi>21</hi> <low>12</low> <sunr>5:42 AM</sunr> <suns>8:02 PM</suns> <part p="d"> <icon>39</icon> <t>Scattered Showers</t> <wind> <s>16</s> <gust>N/A</gust> <d>214</d> <t>SW</t> </wind> <bt>Sct Showers</bt> <ppcp>30</ppcp> <hmid>63</hmid> </part> <part p="n"> <icon>31</icon> <t>Clear</t> <wind> <s>6</s> <gust>N/A</gust> <d>264</d> <t>W</t> </wind> <bt>Clear</bt> <ppcp>0</ppcp> <hmid>65</hmid> </part> </day> </dayf> </weather>
|
@@ -1 +1,9 @@
|
|
1
|
-
<current_observation> <credit>Weather Underground NOAA Weather Station</credit> <credit_URL>http://wunderground.com/</credit_URL> <image> <url>http://icons.
|
1
|
+
<current_observation> <credit>Weather Underground NOAA Weather Station</credit> <credit_URL>http://wunderground.com/</credit_URL> <termsofservice link="http://www.wunderground.com/members/tos.asp#api" /> <image> <url>http://icons-pe.wxug.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> <country_iso3166>CA</country_iso3166> <zip>00000</zip> <latitude>51.11999893</latitude> <longitude>-114.01999664</longitude> <elevation>1084.00000000 ft</elevation> </display_location> <observation_location> <full>Calgary, </full> <city>Calgary</city> <state></state> <country>CA</country> <country_iso3166>CA</country_iso3166> <latitude>51.11999893</latitude> <longitude>-114.01999664</longitude> <elevation>3556 ft</elevation> </observation_location> <station_id>CYYC</station_id> <observation_time>Last Updated on June 1, 4:00 PM MDT</observation_time> <observation_time_rfc822>Wed, 01 Jun 2011 22:00:00 GMT</observation_time_rfc822> <observation_epoch>1306965600</observation_epoch> <local_time>June 1, 4:46 PM MDT</local_time> <local_time_rfc822>Wed, 01 Jun 2011 22:46:38 GMT</local_time_rfc822> <local_epoch>1306968398</local_epoch> <weather>Mostly Cloudy</weather> <temperature_string>63 F (17 C)</temperature_string> <temp_f>63</temp_f> <temp_c>17</temp_c> <relative_humidity>48%</relative_humidity> <wind_string>From the SE at 16 MPH </wind_string> <wind_dir>SE</wind_dir> <wind_degrees>140</wind_degrees> <wind_mph>16</wind_mph> <wind_gust_mph></wind_gust_mph> <pressure_string>29.85 in (1011 mb)</pressure_string> <pressure_mb>1011</pressure_mb> <pressure_in>29.85</pressure_in> <dewpoint_string>43 F (6 C)</dewpoint_string> <dewpoint_f>43</dewpoint_f> <dewpoint_c>6</dewpoint_c>
|
2
|
+
|
3
|
+
<heat_index_string>NA</heat_index_string> <heat_index_f>NA</heat_index_f> <heat_index_c>NA</heat_index_c>
|
4
|
+
|
5
|
+
<windchill_string>NA</windchill_string> <windchill_f>NA</windchill_f> <windchill_c>NA</windchill_c>
|
6
|
+
|
7
|
+
<visibility_mi>30.0</visibility_mi> <visibility_km>48.3</visibility_km> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/mostlycloudy.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/mostlycloudy.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/mostlycloudy.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/mostlycloudy.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/mostlycloudy.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/mostlycloudy.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/mostlycloudy.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/mostlycloudy.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/mostlycloudy.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/mostlycloudy.gif</icon_url> </icon_set> </icons> <icon_url_base>http://icons-pe.wxug.com/graphics/conds/</icon_url_base> <icon_url_name>.GIF</icon_url_name> <icon>mostlycloudy</icon> <forecast_url>http://www.wunderground.com/global/stations/71877.html</forecast_url> <history_url>http://www.wunderground.com/history/airport/CYYC/2011/6/1/DailyHistory.html</history_url> <ob_url>http://www.wunderground.com/cgi-bin/findweather/getForecast?query=51.11999893,-114.01999664</ob_url> </current_observation>
|
8
|
+
|
9
|
+
<!-- 0.075:0 -->
|
@@ -1 +1,13 @@
|
|
1
|
-
<forecast> <txt_forecast> <date
|
1
|
+
<?xml version="1.0" ?> <forecast> <termsofservice link="http://www.wunderground.com/members/tos.asp#api" /> <txt_forecast> <date>6:00 AM MDT</date> <number></number> <forecastday> <period>0</period> <icon>chancetstorms</icon> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/chancetstorms.gif</icon_url> </icon_set> </icons> <title>June 1, 2011</title> <fcttext>Chance of a Thunderstorm. High 15&deg;C (59&deg;F). Winds 21 kph SE</fcttext> <pop>30</pop> </forecastday> <forecastday> <period>1</period> <icon>chancerain</icon> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/chancerain.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/chancerain.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/chancerain.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/chancerain.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/chancerain.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/chancerain.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/chancerain.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/chancerain.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/chancerain.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/chancerain.gif</icon_url> </icon_set> </icons> <title>June 2, 2011</title> <fcttext>Chance of Rain. High 16&deg;C (60&deg;F). Winds 18 kph North</fcttext> <pop>30</pop> </forecastday> <forecastday> <period>2</period> <icon>chancetstorms</icon> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/chancetstorms.gif</icon_url> </icon_set> </icons> <title>June 3, 2011</title> <fcttext>Chance of a Thunderstorm. High 16&deg;C (60&deg;F). Winds 21 kph North</fcttext> <pop>30</pop> </forecastday> <forecastday> <period>3</period> <icon>chancerain</icon> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/chancerain.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/chancerain.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/chancerain.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/chancerain.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/chancerain.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/chancerain.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/chancerain.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/chancerain.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/chancerain.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/chancerain.gif</icon_url> </icon_set> </icons> <title>June 4, 2011</title> <fcttext>Chance of Rain. High 15&deg;C (59&deg;F). Winds 18 kph SSE</fcttext> <pop>30</pop> </forecastday> <forecastday> <period>4</period> <icon>chancerain</icon> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/chancerain.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/chancerain.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/chancerain.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/chancerain.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/chancerain.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/chancerain.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/chancerain.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/chancerain.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/chancerain.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/chancerain.gif</icon_url> </icon_set> </icons> <title>June 5, 2011</title> <fcttext>Chance of Rain. High 24&deg;C (75&deg;F). Winds 7 kph WNW</fcttext> <pop>20</pop> </forecastday> <forecastday> <period>5</period> <icon>chancerain</icon> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/chancerain.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/chancerain.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/chancerain.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/chancerain.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/chancerain.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/chancerain.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/chancerain.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/chancerain.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/chancerain.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/chancerain.gif</icon_url> </icon_set> </icons> <title>June 6, 2011</title> <fcttext>Chance of Rain. High 18&deg;C (64&deg;F). Winds 10 kph East</fcttext> <pop>20</pop> </forecastday> </txt_forecast> <simpleforecast> <forecastday> <period>1</period> <date> <epoch>1306983600</epoch> <pretty_short>9:00 PM MDT</pretty_short> <pretty>9:00 PM MDT on June 01, 2011</pretty> <day>1</day> <month>6</month> <year>2011</year> <yday>151</yday> <hour>21</hour> <min>00</min> <sec>0</sec> <isdst>1</isdst> <monthname>June</monthname> <weekday_short></weekday_short> <weekday>Wednesday</weekday> <ampm>PM</ampm> <tz_short>MDT</tz_short> <tz_long>America/Edmonton</tz_long> </date> <high> <fahrenheit>61</fahrenheit> <celsius>16</celsius> </high> <low> <fahrenheit>45</fahrenheit> <celsius>7</celsius> </low> <conditions>Chance of a Thunderstorm</conditions> <icon>chancetstorms</icon> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/chancetstorms.gif</icon_url> </icon_set> </icons> <skyicon>mostlycloudy</skyicon> <pop>30</pop> </forecastday>
|
2
|
+
|
3
|
+
<forecastday> <period>2</period> <date> <epoch>1307070000</epoch> <pretty_short>9:00 PM MDT</pretty_short> <pretty>9:00 PM MDT on June 02, 2011</pretty> <day>2</day> <month>6</month> <year>2011</year> <yday>152</yday> <hour>21</hour> <min>00</min> <sec>0</sec> <isdst>1</isdst> <monthname>June</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>64</fahrenheit> <celsius>18</celsius> </high> <low> <fahrenheit>45</fahrenheit> <celsius>7</celsius> </low> <conditions>Chance of Rain</conditions> <icon>chancerain</icon> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/chancerain.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/chancerain.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/chancerain.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/chancerain.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/chancerain.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/chancerain.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/chancerain.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/chancerain.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/chancerain.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/chancerain.gif</icon_url> </icon_set> </icons> <skyicon>cloudy</skyicon> <pop>30</pop> </forecastday>
|
4
|
+
|
5
|
+
<forecastday> <period>3</period> <date> <epoch>1307156400</epoch> <pretty_short>9:00 PM MDT</pretty_short> <pretty>9:00 PM MDT on June 03, 2011</pretty> <day>3</day> <month>6</month> <year>2011</year> <yday>153</yday> <hour>21</hour> <min>00</min> <sec>0</sec> <isdst>1</isdst> <monthname>June</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>61</fahrenheit> <celsius>16</celsius> </high> <low> <fahrenheit>36</fahrenheit> <celsius>2</celsius> </low> <conditions>Chance of a Thunderstorm</conditions> <icon>chancetstorms</icon> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/chancetstorms.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/chancetstorms.gif</icon_url> </icon_set> </icons> <skyicon>partlycloudy</skyicon> <pop>40</pop> </forecastday>
|
6
|
+
|
7
|
+
<forecastday> <period>4</period> <date> <epoch>1307242800</epoch> <pretty_short>9:00 PM MDT</pretty_short> <pretty>9:00 PM MDT on June 04, 2011</pretty> <day>4</day> <month>6</month> <year>2011</year> <yday>154</yday> <hour>21</hour> <min>00</min> <sec>0</sec> <isdst>1</isdst> <monthname>June</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>54</fahrenheit> <celsius>12</celsius> </high> <low> <fahrenheit>43</fahrenheit> <celsius>6</celsius> </low> <conditions>Chance of Rain</conditions> <icon>chancerain</icon> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/chancerain.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/chancerain.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/chancerain.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/chancerain.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/chancerain.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/chancerain.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/chancerain.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/chancerain.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/chancerain.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/chancerain.gif</icon_url> </icon_set> </icons> <skyicon>cloudy</skyicon> <pop>20</pop> </forecastday>
|
8
|
+
|
9
|
+
<forecastday> <period>5</period> <date> <epoch>1307329200</epoch> <pretty_short>9:00 PM MDT</pretty_short> <pretty>9:00 PM MDT on June 05, 2011</pretty> <day>5</day> <month>6</month> <year>2011</year> <yday>155</yday> <hour>21</hour> <min>00</min> <sec>0</sec> <isdst>1</isdst> <monthname>June</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>70</fahrenheit> <celsius>21</celsius> </high> <low> <fahrenheit>46</fahrenheit> <celsius>8</celsius> </low> <conditions>Partly Cloudy</conditions> <icon>partlycloudy</icon> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/partlycloudy.gif</icon_url> </icon_set> </icons> <skyicon>partlycloudy</skyicon> <pop>0</pop> </forecastday>
|
10
|
+
|
11
|
+
<forecastday> <period>6</period> <date> <epoch>1307415600</epoch> <pretty_short>9:00 PM MDT</pretty_short> <pretty>9:00 PM MDT on June 06, 2011</pretty> <day>6</day> <month>6</month> <year>2011</year> <yday>156</yday> <hour>21</hour> <min>00</min> <sec>0</sec> <isdst>1</isdst> <monthname>June</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>64</fahrenheit> <celsius>18</celsius> </high> <low> <fahrenheit>52</fahrenheit> <celsius>11</celsius> </low> <conditions>Fog</conditions> <icon>partlycloudy</icon> <icons> <icon_set name="Default"> <icon_url>http://icons-pe.wxug.com/i/c/a/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Smiley"> <icon_url>http://icons-pe.wxug.com/i/c/b/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Generic"> <icon_url>http://icons-pe.wxug.com/i/c/c/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Old School"> <icon_url>http://icons-pe.wxug.com/i/c/d/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Cartoon"> <icon_url>http://icons-pe.wxug.com/i/c/e/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Mobile"> <icon_url>http://icons-pe.wxug.com/i/c/f/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Simple"> <icon_url>http://icons-pe.wxug.com/i/c/g/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Contemporary"> <icon_url>http://icons-pe.wxug.com/i/c/h/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Helen"> <icon_url>http://icons-pe.wxug.com/i/c/i/partlycloudy.gif</icon_url> </icon_set> <icon_set name="Incredible"> <icon_url>http://icons-pe.wxug.com/i/c/k/partlycloudy.gif</icon_url> </icon_set> </icons> <skyicon>partlycloudy</skyicon> <pop>0</pop> </forecastday>
|
12
|
+
|
13
|
+
</simpleforecast> <moon_phase> <percentIlluminated>0</percentIlluminated> <ageOfMoon>0</ageOfMoon> <current_time> <hour>16</hour> <minute>48</minute> </current_time> <sunset> <hour>21</hour> <minute>41</minute> </sunset> <sunrise> <hour>5</hour> <minute>26</minute> </sunrise> </moon_phase> </forecast>
|
@@ -1 +1,3 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> <channel>
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <rss version="2.0" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"> <channel>
|
2
|
+
|
3
|
+
<title>Yahoo! Weather - Beverly Hills, CA</title> <link>http://us.rd.yahoo.com/dailynews/rss/weather/Beverly_Hills__CA/*http://weather.yahoo.com/forecast/USCA0090_c.html</link> <description>Yahoo! Weather for Beverly Hills, CA</description> <language>en-us</language> <lastBuildDate>Wed, 01 Jun 2011 2:50 pm PDT</lastBuildDate> <ttl>60</ttl> <yweather:location city="Beverly Hills" region="CA" country="US"/> <yweather:units temperature="C" distance="km" pressure="mb" speed="km/h"/> <yweather:wind chill="17" direction="230" speed="14.48" /> <yweather:atmosphere humidity="65" visibility="16.09" pressure="1017.8" rising="2" /> <yweather:astronomy sunrise="5:42 am" sunset="7:57 pm"/> <image> <title>Yahoo! Weather</title> <width>142</width> <height>18</height> <link>http://weather.yahoo.com</link> <url>http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif</url> </image> <item> <title>Conditions for Beverly Hills, CA at 2:50 pm PDT</title> <geo:lat>34.08</geo:lat> <geo:long>-118.4</geo:long> <link>http://us.rd.yahoo.com/dailynews/rss/weather/Beverly_Hills__CA/*http://weather.yahoo.com/forecast/USCA0090_c.html</link> <pubDate>Wed, 01 Jun 2011 2:50 pm PDT</pubDate> <yweather:condition text="Fair" code="34" temp="17" date="Wed, 01 Jun 2011 2:50 pm PDT" /> <description><![CDATA[ <img src="http://l.yimg.com/a/i/us/we/52/34.gif"/><br /> <b>Current Conditions:</b><br /> Fair, 17 C<BR /> <BR /><b>Forecast:</b><BR /> Wed - Clear. High: 21 Low: 12<br /> Thu - Mostly Sunny. High: 23 Low: 12<br /> <br /> <a href="http://us.rd.yahoo.com/dailynews/rss/weather/Beverly_Hills__CA/*http://weather.yahoo.com/forecast/USCA0090_c.html">Full Forecast at Yahoo! Weather</a><BR/><BR/> (provided by <a href="http://www.weather.com" >The Weather Channel</a>)<br/> ]]></description> <yweather:forecast day="Wed" date="1 Jun 2011" low="12" high="21" text="Clear" code="31" /> <yweather:forecast day="Thu" date="2 Jun 2011" low="12" high="23" text="Mostly Sunny" code="34" /> <guid isPermaLink="false">USCA0090_2011_06_01_14_50_PDT</guid> </item> </channel> </rss> <!-- api8.weather.ac4.yahoo.com uncompressed/chunked Wed Jun 1 15:44:05 PDT 2011 -->
|
@@ -107,7 +107,7 @@ describe "Query::Coordinates" do
|
|
107
107
|
query = Barometer::Query.new(@geocode)
|
108
108
|
query.format.should == :geocode
|
109
109
|
new_query = Barometer::Query::Format::Coordinates.to(query)
|
110
|
-
new_query.q.should == "40.
|
110
|
+
new_query.q.should == "40.7143528,-74.0059731"
|
111
111
|
new_query.country_code.should == "US"
|
112
112
|
new_query.format.should == :coordinates
|
113
113
|
new_query.geo.should_not be_nil
|
@@ -117,7 +117,7 @@ describe "Query::Coordinates" do
|
|
117
117
|
query = Barometer::Query.new(@postal_code)
|
118
118
|
query.format.should == :postalcode
|
119
119
|
new_query = Barometer::Query::Format::Coordinates.to(query)
|
120
|
-
new_query.q.should == "53.
|
120
|
+
new_query.q.should == "53.570516,-113.45784"
|
121
121
|
new_query.country_code.should == "CA"
|
122
122
|
new_query.format.should == :coordinates
|
123
123
|
new_query.geo.should_not be_nil
|
@@ -137,20 +137,12 @@ describe "Query::Coordinates" do
|
|
137
137
|
query = Barometer::Query.new(@coordinates)
|
138
138
|
query.format.should == :coordinates
|
139
139
|
new_query = Barometer::Query::Format::Coordinates.to(query)
|
140
|
-
new_query.q.should == "40.
|
140
|
+
new_query.q.should == "40.7560395,-73.9869147"
|
141
141
|
new_query.country_code.should == "US"
|
142
142
|
new_query.format.should == :coordinates
|
143
143
|
new_query.geo.should_not be_nil
|
144
144
|
end
|
145
145
|
|
146
|
-
it "skips conversion when no API key" do
|
147
|
-
Barometer.google_geocode_key = nil
|
148
|
-
Barometer.google_geocode_key.should be_nil
|
149
|
-
query = Barometer::Query.new(@short_zipcode)
|
150
|
-
Barometer::Query::Format::Coordinates.to(query).q.should be_nil
|
151
|
-
Barometer.google_geocode_key = KEY
|
152
|
-
end
|
153
|
-
|
154
146
|
end
|
155
147
|
|
156
148
|
describe "parsing" do
|
@@ -16,21 +16,21 @@ describe "Query::Geocode" do
|
|
16
16
|
describe "and class methods" do
|
17
17
|
|
18
18
|
it "returns a format" do
|
19
|
-
Query::Format::Geocode.format.should == :geocode
|
19
|
+
Barometer::Query::Format::Geocode.format.should == :geocode
|
20
20
|
end
|
21
21
|
|
22
22
|
it "returns a country" do
|
23
|
-
Query::Format::Geocode.country_code.should be_nil
|
23
|
+
Barometer::Query::Format::Geocode.country_code.should be_nil
|
24
24
|
end
|
25
25
|
|
26
26
|
it "returns the convertable_formats" do
|
27
|
-
Query::Format::Geocode.convertable_formats.should_not be_nil
|
28
|
-
Query::Format::Geocode.convertable_formats.is_a?(Array).should be_true
|
29
|
-
Query::Format::Geocode.convertable_formats.include?(:short_zipcode).should be_true
|
30
|
-
Query::Format::Geocode.convertable_formats.include?(:zipcode).should be_true
|
31
|
-
Query::Format::Geocode.convertable_formats.include?(:coordinates).should be_true
|
32
|
-
Query::Format::Geocode.convertable_formats.include?(:weather_id).should be_true
|
33
|
-
Query::Format::Geocode.convertable_formats.include?(:icao).should be_true
|
27
|
+
Barometer::Query::Format::Geocode.convertable_formats.should_not be_nil
|
28
|
+
Barometer::Query::Format::Geocode.convertable_formats.is_a?(Array).should be_true
|
29
|
+
Barometer::Query::Format::Geocode.convertable_formats.include?(:short_zipcode).should be_true
|
30
|
+
Barometer::Query::Format::Geocode.convertable_formats.include?(:zipcode).should be_true
|
31
|
+
Barometer::Query::Format::Geocode.convertable_formats.include?(:coordinates).should be_true
|
32
|
+
Barometer::Query::Format::Geocode.convertable_formats.include?(:weather_id).should be_true
|
33
|
+
Barometer::Query::Format::Geocode.convertable_formats.include?(:icao).should be_true
|
34
34
|
end
|
35
35
|
|
36
36
|
describe "is?," do
|
@@ -40,8 +40,8 @@ describe "Query::Geocode" do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it "recognizes a valid format" do
|
43
|
-
Query::Format::Geocode.is?(@valid).should be_true
|
44
|
-
Query::Format::Geocode.is?.should be_false
|
43
|
+
Barometer::Query::Format::Geocode.is?(@valid).should be_true
|
44
|
+
Barometer::Query::Format::Geocode.is?.should be_false
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
@@ -53,33 +53,33 @@ describe "Query::Geocode" do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "requires a Barometer::Query object" do
|
56
|
-
lambda { Query::Format::Geocode.to }.should raise_error(ArgumentError)
|
57
|
-
lambda { Query::Format::Geocode.to("invalid") }.should raise_error(ArgumentError)
|
56
|
+
lambda { Barometer::Query::Format::Geocode.to }.should raise_error(ArgumentError)
|
57
|
+
lambda { Barometer::Query::Format::Geocode.to("invalid") }.should raise_error(ArgumentError)
|
58
58
|
query = Barometer::Query.new(@zipcode)
|
59
59
|
query.is_a?(Barometer::Query).should be_true
|
60
|
-
lambda { Query::Format::Geocode.to(query) }.should_not raise_error(ArgumentError)
|
60
|
+
lambda { Barometer::Query::Format::Geocode.to(query) }.should_not raise_error(ArgumentError)
|
61
61
|
end
|
62
62
|
|
63
63
|
it "returns a Barometer::Query" do
|
64
64
|
query = Barometer::Query.new(@short_zipcode)
|
65
|
-
Query::Format::Geocode.to(query).is_a?(Barometer::Query).should be_true
|
65
|
+
Barometer::Query::Format::Geocode.to(query).is_a?(Barometer::Query).should be_true
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
it "converts from short_zipcode" do
|
69
69
|
query = Barometer::Query.new(@short_zipcode)
|
70
70
|
query.format.should == :short_zipcode
|
71
|
-
new_query = Query::Format::Geocode.to(query)
|
71
|
+
new_query = Barometer::Query::Format::Geocode.to(query)
|
72
72
|
new_query.q.should == "Beverly Hills, CA, USA"
|
73
73
|
new_query.country_code.should == "US"
|
74
74
|
new_query.format.should == :geocode
|
75
75
|
new_query.geo.should_not be_nil
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
it "converts from zipcode" do
|
79
79
|
query = Barometer::Query.new(@zipcode)
|
80
80
|
query.format = :zipcode
|
81
81
|
query.format.should == :zipcode
|
82
|
-
new_query = Query::Format::Geocode.to(query)
|
82
|
+
new_query = Barometer::Query::Format::Geocode.to(query)
|
83
83
|
new_query.q.should == "Beverly Hills, CA, USA"
|
84
84
|
new_query.country_code.should == "US"
|
85
85
|
new_query.format.should == :geocode
|
@@ -89,7 +89,7 @@ describe "Query::Geocode" do
|
|
89
89
|
it "converts from weather_id" do
|
90
90
|
query = Barometer::Query.new(@weather_id)
|
91
91
|
query.format.should == :weather_id
|
92
|
-
new_query = Query::Format::Geocode.to(query)
|
92
|
+
new_query = Barometer::Query::Format::Geocode.to(query)
|
93
93
|
new_query.q.should == "Atlanta, GA, US"
|
94
94
|
new_query.country_code.should be_nil
|
95
95
|
new_query.format.should == :geocode
|
@@ -99,8 +99,8 @@ describe "Query::Geocode" do
|
|
99
99
|
it "converts from coordinates" do
|
100
100
|
query = Barometer::Query.new(@coordinates)
|
101
101
|
query.format.should == :coordinates
|
102
|
-
new_query = Query::Format::Geocode.to(query)
|
103
|
-
new_query.q.should == "
|
102
|
+
new_query = Barometer::Query::Format::Geocode.to(query)
|
103
|
+
new_query.q.should == "Manhattan, NY, USA"
|
104
104
|
new_query.country_code.should == "US"
|
105
105
|
new_query.format.should == :geocode
|
106
106
|
new_query.geo.should_not be_nil
|
@@ -109,8 +109,8 @@ describe "Query::Geocode" do
|
|
109
109
|
it "converts from icao" do
|
110
110
|
query = Barometer::Query.new(@icao)
|
111
111
|
query.format.should == :icao
|
112
|
-
new_query = Query::Format::Geocode.to(query)
|
113
|
-
new_query.q.should == "
|
112
|
+
new_query = Barometer::Query::Format::Geocode.to(query)
|
113
|
+
new_query.q.should == "San Francisco, CA, USA"
|
114
114
|
new_query.country_code.should == "US"
|
115
115
|
new_query.format.should == :geocode
|
116
116
|
new_query.geo.should_not be_nil
|
@@ -119,59 +119,51 @@ describe "Query::Geocode" do
|
|
119
119
|
it "does not convert postalcode" do
|
120
120
|
query = Barometer::Query.new(@postal_code)
|
121
121
|
query.format.should == :postalcode
|
122
|
-
new_query = Query::Format::Geocode.to(query)
|
122
|
+
new_query = Barometer::Query::Format::Geocode.to(query)
|
123
123
|
new_query.should be_nil
|
124
124
|
end
|
125
125
|
|
126
126
|
it "leaves geocode untouched" do
|
127
127
|
query = Barometer::Query.new(@geocode)
|
128
128
|
query.format.should == :geocode
|
129
|
-
new_query = Query::Format::Geocode.to(query)
|
129
|
+
new_query = Barometer::Query::Format::Geocode.to(query)
|
130
130
|
new_query.q.should == "New York, NY"
|
131
131
|
new_query.country_code.should be_nil
|
132
132
|
new_query.format.should == :geocode
|
133
133
|
new_query.geo.should be_nil
|
134
134
|
end
|
135
|
-
|
136
|
-
it "skips conversion when no API key" do
|
137
|
-
Barometer.google_geocode_key = nil
|
138
|
-
Barometer.google_geocode_key.should be_nil
|
139
|
-
query = Barometer::Query.new(@coordinates)
|
140
|
-
Query::Format::Geocode.to(query).q.should be_nil
|
141
|
-
Barometer.google_geocode_key = KEY
|
142
|
-
end
|
143
135
|
|
144
136
|
end
|
145
137
|
|
146
138
|
describe "when geocoding" do
|
147
139
|
|
148
140
|
it "requires a Barometer::Query object" do
|
149
|
-
lambda { Query::Format::Geocode.geocode }.should raise_error(ArgumentError)
|
150
|
-
lambda { Query::Format::Geocode.geocode("invalid") }.should raise_error(ArgumentError)
|
141
|
+
lambda { Barometer::Query::Format::Geocode.geocode }.should raise_error(ArgumentError)
|
142
|
+
lambda { Barometer::Query::Format::Geocode.geocode("invalid") }.should raise_error(ArgumentError)
|
151
143
|
query = Barometer::Query.new(@zipcode)
|
152
144
|
query.is_a?(Barometer::Query).should be_true
|
153
|
-
lambda { Query::Format::Geocode.geocode(original_query) }.should_not raise_error(ArgumentError)
|
145
|
+
lambda { Barometer::Query::Format::Geocode.geocode(original_query) }.should_not raise_error(ArgumentError)
|
154
146
|
end
|
155
147
|
|
156
148
|
it "returns a Barometer::Query" do
|
157
149
|
query = Barometer::Query.new(@short_zipcode)
|
158
|
-
Query::Format::Geocode.geocode(query).is_a?(Barometer::Query).should be_true
|
150
|
+
Barometer::Query::Format::Geocode.geocode(query).is_a?(Barometer::Query).should be_true
|
159
151
|
end
|
160
152
|
|
161
153
|
it "converts from short_zipcode" do
|
162
154
|
query = Barometer::Query.new(@short_zipcode)
|
163
155
|
query.format.should == :short_zipcode
|
164
|
-
new_query = Query::Format::Geocode.geocode(query)
|
156
|
+
new_query = Barometer::Query::Format::Geocode.geocode(query)
|
165
157
|
new_query.q.should == "Beverly Hills, CA, USA"
|
166
158
|
new_query.country_code.should == "US"
|
167
159
|
new_query.format.should == :geocode
|
168
160
|
new_query.geo.should_not be_nil
|
169
161
|
end
|
170
|
-
|
162
|
+
|
171
163
|
end
|
172
164
|
|
173
165
|
it "doesn't define a regex" do
|
174
|
-
lambda { Query::Format::Geocode.regex }.should raise_error(NotImplementedError)
|
166
|
+
lambda { Barometer::Query::Format::Geocode.regex }.should raise_error(NotImplementedError)
|
175
167
|
end
|
176
168
|
|
177
169
|
end
|
@@ -109,10 +109,6 @@ describe "Query::WeatherID" do
|
|
109
109
|
|
110
110
|
describe "when converting using 'to'," do
|
111
111
|
|
112
|
-
before(:each) do
|
113
|
-
Barometer.google_geocode_key = KEY
|
114
|
-
end
|
115
|
-
|
116
112
|
it "requires a Barometer::Query object" do
|
117
113
|
lambda { Query::Format::WeatherID.to }.should raise_error(ArgumentError)
|
118
114
|
lambda { Query::Format::WeatherID.to("invalid") }.should raise_error(ArgumentError)
|
data/spec/formats/woe_id_spec.rb
CHANGED
@@ -119,10 +119,6 @@ describe "Query::WoeID" do
|
|
119
119
|
|
120
120
|
describe "when converting using 'to'," do
|
121
121
|
|
122
|
-
before(:each) do
|
123
|
-
Barometer.google_geocode_key = KEY
|
124
|
-
end
|
125
|
-
|
126
122
|
it "requires a Barometer::Query object" do
|
127
123
|
lambda { Query::Format::WoeID.to }.should raise_error(ArgumentError)
|
128
124
|
lambda { Query::Format::WoeID.to("invalid") }.should raise_error(ArgumentError)
|
data/spec/query_spec.rb
CHANGED
@@ -16,17 +16,14 @@ describe "Query" do
|
|
16
16
|
@zipcode_to_coordinates = "34.1030032,-118.4104684"
|
17
17
|
@zipcode_to_geocode = "Beverly Hills, CA, USA"
|
18
18
|
@zipcode_to_weather_id = "USCA0090"
|
19
|
-
@postalcode_to_coordinates = "53.
|
20
|
-
@geocode_to_coordinates = "40.
|
19
|
+
@postalcode_to_coordinates = "53.570516,-113.45784"
|
20
|
+
@geocode_to_coordinates = "40.7143528,-74.0059731"
|
21
21
|
@geocode_to_weather_id = "USNY0996"
|
22
|
-
@coordinates_to_geocode = "
|
22
|
+
@coordinates_to_geocode = "Manhattan, NY, USA"
|
23
23
|
@coordinates_to_weather_id = "USNY0996"
|
24
24
|
@icao_to_coordinates = "37.615223,-122.389979"
|
25
|
-
@icao_to_geocode = "
|
25
|
+
@icao_to_geocode = "San Francisco, CA, USA"
|
26
26
|
@icao_to_weather_id = "USCA0987"
|
27
|
-
|
28
|
-
Barometer.google_geocode_key = nil
|
29
|
-
#Barometer.skip_graticule = true
|
30
27
|
end
|
31
28
|
|
32
29
|
describe "determines the query format" do
|
@@ -135,16 +132,6 @@ describe "Query" do
|
|
135
132
|
query.format.should_not be_nil
|
136
133
|
end
|
137
134
|
|
138
|
-
it "responds to google_api_key" do
|
139
|
-
Barometer.google_geocode_key.should be_nil
|
140
|
-
end
|
141
|
-
|
142
|
-
it "defaults to the Module geocode key" do
|
143
|
-
key = "KEY"
|
144
|
-
Barometer.google_geocode_key = key
|
145
|
-
Barometer.google_geocode_key.should == key
|
146
|
-
end
|
147
|
-
|
148
135
|
it "responds to geo" do
|
149
136
|
@query.geo.should be_nil
|
150
137
|
end
|
@@ -244,7 +231,6 @@ describe "Query" do
|
|
244
231
|
|
245
232
|
before(:each) do
|
246
233
|
@query = Barometer::Query.new(@short_zipcode)
|
247
|
-
Barometer.google_geocode_key = KEY
|
248
234
|
end
|
249
235
|
|
250
236
|
it "converts to zipcode" do
|
@@ -293,7 +279,6 @@ describe "Query" do
|
|
293
279
|
|
294
280
|
before(:each) do
|
295
281
|
@query = Barometer::Query.new(@zipcode)
|
296
|
-
Barometer.google_geocode_key = KEY
|
297
282
|
Barometer.force_geocode = false
|
298
283
|
end
|
299
284
|
|
@@ -343,7 +328,6 @@ describe "Query" do
|
|
343
328
|
|
344
329
|
before(:each) do
|
345
330
|
@query = Barometer::Query.new(@postal_code)
|
346
|
-
Barometer.google_geocode_key = KEY
|
347
331
|
end
|
348
332
|
|
349
333
|
it "converts to coordinates" do
|
@@ -389,7 +373,6 @@ describe "Query" do
|
|
389
373
|
|
390
374
|
before(:each) do
|
391
375
|
@query = Barometer::Query.new(@icao)
|
392
|
-
Barometer.google_geocode_key = KEY
|
393
376
|
end
|
394
377
|
|
395
378
|
it "converts to coordinates" do
|
@@ -437,7 +420,6 @@ describe "Query" do
|
|
437
420
|
|
438
421
|
before(:each) do
|
439
422
|
@query = Barometer::Query.new(@geocode)
|
440
|
-
Barometer.google_geocode_key = KEY
|
441
423
|
end
|
442
424
|
|
443
425
|
it "converts to coordinates" do
|
@@ -484,7 +466,6 @@ describe "Query" do
|
|
484
466
|
|
485
467
|
before(:each) do
|
486
468
|
@query = Barometer::Query.new(@coordinates)
|
487
|
-
Barometer.google_geocode_key = KEY
|
488
469
|
end
|
489
470
|
|
490
471
|
it "converts to geocode" do
|
data/spec/spec_helper.rb
CHANGED
@@ -162,21 +162,21 @@ describe "WeatherDotCom" do
|
|
162
162
|
result = WeatherService::WeatherDotCom._measure(@measurement, @query)
|
163
163
|
|
164
164
|
# build current
|
165
|
-
@measurement.current.humidity.to_i.should ==
|
166
|
-
@measurement.current.icon.should == "
|
165
|
+
@measurement.current.humidity.to_i.should == 65
|
166
|
+
@measurement.current.icon.should == "34"
|
167
167
|
@measurement.current.condition.should == "Fair"
|
168
|
-
@measurement.current.temperature.to_i.should ==
|
169
|
-
@measurement.current.dew_point.to_i.should ==
|
170
|
-
@measurement.current.wind_chill.to_i.should ==
|
171
|
-
@measurement.current.wind.to_i.should ==
|
172
|
-
@measurement.current.wind.degrees.to_i.should ==
|
173
|
-
@measurement.current.wind.direction.should == "
|
174
|
-
@measurement.current.pressure.to_f.should ==
|
168
|
+
@measurement.current.temperature.to_i.should == 17
|
169
|
+
@measurement.current.dew_point.to_i.should == 10
|
170
|
+
@measurement.current.wind_chill.to_i.should == 17
|
171
|
+
@measurement.current.wind.to_i.should == 14
|
172
|
+
@measurement.current.wind.degrees.to_i.should == 230
|
173
|
+
@measurement.current.wind.direction.should == "SW"
|
174
|
+
@measurement.current.pressure.to_f.should == 1017.9
|
175
175
|
@measurement.current.visibility.to_f.should == 16.1
|
176
176
|
|
177
177
|
# build sun
|
178
|
-
@measurement.current.sun.rise.to_s.should == "
|
179
|
-
@measurement.current.sun.set.to_s.should == "
|
178
|
+
@measurement.current.sun.rise.to_s.should == "05:43 am"
|
179
|
+
@measurement.current.sun.set.to_s.should == "08:00 pm"
|
180
180
|
|
181
181
|
# builds location
|
182
182
|
@measurement.location.name.should == "Beverly Hills, CA (90210)"
|
@@ -187,35 +187,35 @@ describe "WeatherDotCom" do
|
|
187
187
|
@measurement.forecast.size.should == 10
|
188
188
|
|
189
189
|
# day
|
190
|
-
@measurement.forecast[0].valid_start_date.should == Date.parse("
|
191
|
-
@measurement.forecast[0].valid_end_date.should == Date.parse("
|
192
|
-
@measurement.forecast[0].condition.should == "
|
193
|
-
@measurement.forecast[0].icon.should == "
|
190
|
+
@measurement.forecast[0].valid_start_date.should == Date.parse("Jun 1 7:00 am")
|
191
|
+
@measurement.forecast[0].valid_end_date.should == Date.parse("Jun 1 6:59:59 pm")
|
192
|
+
@measurement.forecast[0].condition.should == "N/A"
|
193
|
+
@measurement.forecast[0].icon.should == "44"
|
194
194
|
@measurement.forecast[0].high.should be_nil
|
195
|
-
@measurement.forecast[0].low.to_i.should ==
|
196
|
-
@measurement.forecast[0].pop.to_i.should ==
|
197
|
-
@measurement.forecast[0].humidity.to_i.should ==
|
195
|
+
@measurement.forecast[0].low.to_i.should == 12
|
196
|
+
@measurement.forecast[0].pop.to_i.should == 0
|
197
|
+
@measurement.forecast[0].humidity.to_i.should == 0
|
198
198
|
|
199
|
-
@measurement.forecast[0].wind.
|
200
|
-
@measurement.forecast[0].wind.to_i.should
|
201
|
-
@measurement.forecast[0].wind.degrees.to_i.should ==
|
202
|
-
@measurement.forecast[0].wind.direction.should == "
|
199
|
+
@measurement.forecast[0].wind.should be_nil
|
200
|
+
@measurement.forecast[0].wind.to_i.should be_nil
|
201
|
+
@measurement.forecast[0].wind.degrees.to_i.should == 0
|
202
|
+
@measurement.forecast[0].wind.direction.should == "N/A"
|
203
203
|
|
204
|
-
@measurement.forecast[0].sun.rise.to_s.should == "
|
205
|
-
@measurement.forecast[0].sun.set.to_s.should == "
|
204
|
+
@measurement.forecast[0].sun.rise.to_s.should == "05:43 am"
|
205
|
+
@measurement.forecast[0].sun.set.to_s.should == "08:00 pm"
|
206
206
|
|
207
207
|
# night
|
208
208
|
@measurement.forecast[1].should_not be_nil
|
209
|
-
@measurement.forecast[1].valid_start_date.should == Date.parse("
|
210
|
-
@measurement.forecast[1].valid_end_date.should == Date.parse("
|
211
|
-
@measurement.forecast[1].condition.should == "
|
212
|
-
@measurement.forecast[1].icon.should == "
|
213
|
-
@measurement.forecast[1].pop.to_i.should ==
|
214
|
-
@measurement.forecast[1].humidity.to_i.should ==
|
209
|
+
@measurement.forecast[1].valid_start_date.should == Date.parse("Jun 1 7:00 pm")
|
210
|
+
@measurement.forecast[1].valid_end_date.should == Date.parse("Jun 2 6:59:59 am")
|
211
|
+
@measurement.forecast[1].condition.should == "Clear"
|
212
|
+
@measurement.forecast[1].icon.should == "31"
|
213
|
+
@measurement.forecast[1].pop.to_i.should == 0
|
214
|
+
@measurement.forecast[1].humidity.to_i.should == 62
|
215
215
|
|
216
216
|
@measurement.forecast[1].wind.should_not be_nil
|
217
|
-
@measurement.forecast[1].wind.to_i.should ==
|
218
|
-
@measurement.forecast[1].wind.degrees.to_i.should ==
|
217
|
+
@measurement.forecast[1].wind.to_i.should == 16
|
218
|
+
@measurement.forecast[1].wind.degrees.to_i.should == 343
|
219
219
|
@measurement.forecast[1].wind.direction.should == "NNW"
|
220
220
|
end
|
221
221
|
|