class OpenWeather::Current

current weather

Constants

URL

Public Class Methods

humidity() click to toggle source
# File lib/current.rb, line 23
def self.humidity
  weather if weather.nil?
  weather.humidity
end
icon() click to toggle source
# File lib/current.rb, line 43
def self.icon
  weather if weather.nil?
  weather.icon
end
load_weather() click to toggle source
# File lib/current.rb, line 48
def self.load_weather
  response = RestClient.get url
  if response.code == 200
    json = JSON.parse response.body
    @weather = Weather.new(json)
  else
    @weather = Weather.new
  end
end
speed() click to toggle source
# File lib/current.rb, line 18
def self.speed
  weather if weather.nil?
  weather.speed
end
temp() click to toggle source
# File lib/current.rb, line 28
def self.temp
  weather if weather.nil?
  weather.temp
end
temp_max() click to toggle source
# File lib/current.rb, line 38
def self.temp_max
  weather if weather.nil?
  weather.temp_max
end
temp_min() click to toggle source
# File lib/current.rb, line 33
def self.temp_min
  weather if weather.nil?
  weather.temp_min
end
url() click to toggle source
# File lib/current.rb, line 58
def self.url
  URL + "&appid=#{API_KEY}"
end
weather() click to toggle source
# File lib/current.rb, line 9
def self.weather
  if Manager.can_consume?
    @weather = load_weather
    @weather
  else
    @weather
  end
end