Sha256: d13c3a27a47f964923e99a39839251e7256be984af1b520336002f8663ef8477
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
class YahooWeather::Response attr_reader :doc, :title, :link, :description, :language, :last_build_date, :ttl, :lat, :long def initialize(doc) @doc = doc['query']['results']['channel'] @title = @doc['item']['title'] @link = @doc['link'] @description = @doc['description'] @language = @doc['language'] @last_build_date = Time.parse(@doc['lastBuildDate']) @ttl = @doc['ttl'].to_i @lat = @doc['item']['lat'].to_f @long = @doc['item']['long'].to_f end def location YahooWeather::Location.new(@doc['location']) end def units YahooWeather::Units.new(@doc['units']) end def astronomy YahooWeather::Astronomy.new(@doc['astronomy']) end def atmosphere YahooWeather::Atmosphere.new(@doc['atmosphere']) end def condition YahooWeather::Condition.new(@doc['item']['condition']) end def wind YahooWeather::Wind.new(@doc['wind']) end def forecasts forecasts = [] @doc['item']['forecast'].each do |forecast| forecasts << YahooWeather::Forecast.new(forecast) end forecasts end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yahoo_weather-1.2.0 | lib/yahoo_weather/response.rb |