Module: OpenWeather::Weather
- Defined in:
- lib/OpenWeather/weather.rb
Instance Method Summary collapse
Instance Method Details
#weather_max(city) ⇒ Object
17 18 19 20 |
# File 'lib/OpenWeather/weather.rb', line 17 def weather_max(city) weather = weather_raw(city) weather['main']['temp_max'] end |
#weather_min(city) ⇒ Object
12 13 14 15 |
# File 'lib/OpenWeather/weather.rb', line 12 def weather_min(city) weather = weather_raw(city) weather['main']['temp_min'] end |
#weather_raw(city) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/OpenWeather/weather.rb', line 3 def weather_raw(city) city.is_number? ? query = {id: city, units: @units_format, mode: @data_format} : query = {q: city, units: @units_format, mode: @data_format} @city_file.nil? ? get('/weather', query: query) : JSON.parse(File.read(@city_file)) end |