class Weather::Response

Attributes

astronomy[R]

a Weather::Astronomy object containing sunrise and sunset information for the requested location

atmosphere[R]

a Weather::Atmosphere object containing the atmosphere information for the requested location

condition[R]

a Weather::Condition object detailing the current conditions of the requested location

description[R]

the HTML summarizing current weather conditions for the requested location

forecasts[R]

a collection of Weather::Forecast objects containing high-level forecasted weather for upcoming days

image[R]

a Weather::Image object containing an image icon representing the current weather for the requested location

latitude[R]

the latitude for the requested location

location[R]

a Weather::Location object containing the geographical names of the requested location

longitude[R]

the longitude for the requested location

request_location[R]

the location string initially requested of the service.

request_url[R]

the url with which the Yahoo! Weather service was accessed to build the response

title[R]

the title of the weather information for the requested location

units[R]

a Weather::Units object containig the units corresponding to the information contained in the response

wind[R]

a Weather::Wind object containing the wind information for the requested location

Public Class Methods

new(request_location, request_url, doc) click to toggle source
# File lib/weather-api/response.rb, line 55
def initialize(request_location, request_url, doc)
  # save the request params
  @request_location = request_location
  @request_url      = request_url

  @astronomy  = Astronomy.new doc[:astronomy]
  @location   = Location.new doc[:location]
  @units      = Units.new doc[:units]
  @wind       = Wind.new doc[:wind]
  @atmosphere = Atmosphere.new doc[:atmosphere]
  @image      = Image.new doc[:item][:description]

  @forecasts = []

  @condition  = Condition.new doc[:item][:condition]

  doc[:item][:forecast].each do |forecast|
    @forecasts << Forecast.new(forecast)
  end

  @latitude    = doc[:item][:lat].to_f
  @longitude   = doc[:item][:long].to_f
  @title       = doc[:item][:title].strip
  @description = doc[:item][:description].strip
end