class OpenWeather::Forecast

Constants

URL

Public Class Methods

load_weather() click to toggle source
# File lib/forecast.rb, line 14
def self.load_weather
  response = RestClient.get url
  if response.code == 200
    json = JSON.parse response.body
    @weathers = json['list'].collect { |j| Weather.new(j) }
  else
    @weathers = []
  end
end
url() click to toggle source
# File lib/forecast.rb, line 24
def self.url
  URL + "&appid=#{API_KEY}"
end
weathers() click to toggle source
# File lib/forecast.rb, line 5
def self.weathers
  if Manager.can_consume?
    @weathers = load_weather
    @weathers
  else
    @weathers
  end
end