module OpenWeather::Weather

Public Instance Methods

weather_max(city) click to toggle source
# File lib/OpenWeather/weather.rb, line 17
def weather_max(city)
  weather = weather_raw(city)
  weather['main']['temp_max']
end
weather_min(city) click to toggle source
# File lib/OpenWeather/weather.rb, line 12
def weather_min(city)
  weather = weather_raw(city)
  weather['main']['temp_min']
end
weather_raw(city) click to toggle source
# 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