Class: Forecast::Adapters::YahooAdapter
- Inherits:
-
Object
- Object
- Forecast::Adapters::YahooAdapter
show all
- Includes:
- Forecast::Adapter
- Defined in:
- lib/forecast/adapters/yahoo_adapter.rb
Constant Summary
collapse
- URL_YQL =
'http://query.yahooapis.com/v1/public/yql'
'http://weather.yahooapis.com/forecastrss'
Instance Method Summary
collapse
included, #initialize, instance
Instance Method Details
#current(latitude, longitude) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/forecast/adapters/yahoo_adapter.rb', line 10
def current(latitude, longitude)
forecast = nil
doc = (latitude, longitude)
if doc
hash = {}
doc.elements.each('rss/channel/item/yweather:condition') do |elem|
elem.attributes.each() do |attr|
hash[attr[0].to_sym] = attr[1]
end
end
forecast = get_forecast({latitude: latitude, longitude: longitude}.merge(hash))
end
return forecast
end
|
#daily(latitude, longitude) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/forecast/adapters/yahoo_adapter.rb', line 30
def daily(latitude, longitude)
doc = (latitude, longitude)
forecasts = Forecast::Collection.new
if doc
doc.elements.each('rss/channel/item/yweather:forecast') do |elem|
hash = {}
elem.attributes.each() do |attr|
hash[attr[0].to_sym] = attr[1]
end
forecasts << get_forecast({latitude: latitude, longitude: longitude}.merge(hash))
end
end
return forecasts
end
|
#hourly(latitude, longitude) ⇒ Object
25
26
27
28
|
# File 'lib/forecast/adapters/yahoo_adapter.rb', line 25
def hourly(latitude, longitude)
return []
end
|