alexmchale-wunderground-api 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +4 -0
- data/lib/wunderground.rb +8 -2
- metadata +3 -2
data/VERSION.yml
ADDED
data/lib/wunderground.rb
CHANGED
@@ -15,11 +15,17 @@ class Wunderground
|
|
15
15
|
def initialize(location)
|
16
16
|
@location = location
|
17
17
|
@params = { :query => location }.to_url
|
18
|
+
|
19
|
+
data = Net::HTTP.get(URI.parse "http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?#{@params}")
|
20
|
+
@xml = XmlSimple.xml_in(data, { 'ForceArray' => false })
|
21
|
+
end
|
22
|
+
|
23
|
+
def today
|
24
|
+
@xml.andand['txt_forecast'].andand['forecastday'].sort {|a, b| a['period'].to_i <=> b['period'].to_i}
|
18
25
|
end
|
19
26
|
|
20
27
|
def forecast
|
21
|
-
|
22
|
-
XmlSimple.xml_in(data, { 'ForceArray' => false }).andand['simpleforecast'].andand['forecastday']
|
28
|
+
@xml.andand['simpleforecast'].andand['forecastday']
|
23
29
|
end
|
24
30
|
|
25
31
|
def simple_forecast(days = 3)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alexmchale-wunderground-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex McHale
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-11 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -22,6 +22,7 @@ extensions: []
|
|
22
22
|
extra_rdoc_files:
|
23
23
|
- README.markdown
|
24
24
|
files:
|
25
|
+
- VERSION.yml
|
25
26
|
- README.markdown
|
26
27
|
- lib/wunderground.rb
|
27
28
|
has_rdoc: true
|