Class: Forecast::Adapters::OpenWeatherMapAdapter
- Inherits:
-
Object
- Object
- Forecast::Adapters::OpenWeatherMapAdapter
show all
- Includes:
- Forecast::Adapter
- Defined in:
- lib/forecast/adapters/open_weather_map_adapter.rb
Instance Method Summary
collapse
included, #initialize, instance
Instance Method Details
#current(latitude, longitude) ⇒ Object
7
8
9
10
11
12
13
|
# File 'lib/forecast/adapters/open_weather_map_adapter.rb', line 7
def current(latitude, longitude)
hash = get_json(get_action('weather', latitude, longitude))
if hash
result = get_forecast({latitude: latitude, longitude: longitude}.merge(hash))
return result
end
end
|
#daily(latitude, longitude) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/forecast/adapters/open_weather_map_adapter.rb', line 26
def daily(latitude, longitude)
json = get_json(get_action('forecast/daily', latitude, longitude))
result = Forecast::Collection.new
if json && json.has_key?('list')
result = Forecast::Collection.new
json['list'].each do |hash|
result << get_forecast({latitude: latitude, longitude: longitude}.merge(hash))
end
end
return result
end
|
#hourly(latitude, longitude) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/forecast/adapters/open_weather_map_adapter.rb', line 15
def hourly(latitude, longitude)
json = get_json(get_action('forecast', latitude, longitude))
result = Forecast::Collection.new
if json && json.has_key?('list')
json['list'].each do |hash|
result << get_forecast({latitude: latitude, longitude: longitude}.merge(hash))
end
end
return result
end
|