Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/weather-api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class << self
# Weather::Units::CELSIUS constants. Defaults to Celsius
#
# Returns a Weather::Response object containing forecast
def lookup(woeid, unit = Units::CELSIUS)
def lookup(city,state, unit = Units::CELSIUS)
acceptable_units = [Units::CELSIUS, Units::FAHRENHEIT]
unit = Units::CELSIUS unless acceptable_units.include?(unit)

url = ROOT + "?q=select%20*%20from%20weather.forecast%20"
url += "where%20woeid%3D#{woeid}%20and%20u%3D'#{unit}'&format=json"
url += "where%20woeid%%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22#{city}%2C%20#{state}%22)%20and%20u%3D'#{unit}'&format=json"

doc = get_response url
Response.new woeid, url, doc
Expand Down