Skip to content
Open

fh #4

Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: git://github.com/firstdraft/grade_runner.git
revision: 881cce30367bc9a5f15a3e4ac4cb48599dbecec2
revision: 83db5d2b90086055aa3204afe38a18394aecea16
specs:
grade_runner (0.0.1)

Expand Down Expand Up @@ -59,7 +59,7 @@ GEM
addressable (2.5.1)
public_suffix (~> 2.0, >= 2.0.2)
arel (7.1.4)
autoprefixer-rails (7.1.1.3)
autoprefixer-rails (7.1.2.2)
execjs
awesome_print (1.8.0)
better_errors (2.1.1)
Expand Down Expand Up @@ -102,7 +102,7 @@ GEM
globalid (0.4.0)
activesupport (>= 4.2.0)
hashdiff (0.3.4)
i18n (0.8.4)
i18n (0.8.6)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
Expand Down Expand Up @@ -183,7 +183,7 @@ GEM
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
safe_yaml (1.0.4)
sass (3.4.24)
sass (3.4.25)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
Expand Down
13 changes: 7 additions & 6 deletions app/controllers/forecast_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ def coords_to_weather
# The longitude the user input is in the string @lng.
# ==========================================================================

url = "https://api.darksky.net/forecast/6842c74db30df2e42d7a490dc31acdd3/"+@lat+","+@lng #37.8267,-122.4233
parsed_data = JSON.parse(open(url).read)

@current_temperature = parsed_data.dig("currently","temperature").to_s

@current_temperature = "Replace this string with your answer."
@current_summary = parsed_data.dig("currently","summary").to_s

@current_summary = "Replace this string with your answer."
@summary_of_next_sixty_minutes = parsed_data.dig("minutely","summary").to_s

@summary_of_next_sixty_minutes = "Replace this string with your answer."
@summary_of_next_several_hours = parsed_data.dig("hourly","summary").to_s

@summary_of_next_several_hours = "Replace this string with your answer."

@summary_of_next_several_days = "Replace this string with your answer."
@summary_of_next_several_days = parsed_data.dig("daily","summary").to_s

render("forecast/coords_to_weather.html.erb")
end
Expand Down
14 changes: 8 additions & 6 deletions app/controllers/geocoding_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ def street_to_coords
#
# The street address that the user typed is in the variable @street_address.
# ==========================================================================



@latitude = "Replace this string with your answer."

@longitude = "Replace this string with your answer."

url = "https://maps.googleapis.com/maps/api/geocode/json?address=" + @street_address
parsed_data = JSON.parse(open(url).read)
latitude = parsed_data["results"][0]["geometry"]["location"]["lat"]
longitude = parsed_data["results"][0]["geometry"]["location"]["lng"]
@latitude = latitude

@longitude = longitude

render("geocoding/street_to_coords.html.erb")
end
Expand Down
19 changes: 12 additions & 7 deletions app/controllers/meteorologist_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,23 @@ def street_to_weather
#
# The street address that the user typed is in the variable @street_address.
# ==========================================================================

geocodeUrl = "https://maps.googleapis.com/maps/api/geocode/json?address=" + @street_address
parsed_address = JSON.parse(open(geocodeUrl).read)
latitude = parsed_address["results"][0]["geometry"]["location"]["lat"]
longitude = parsed_address["results"][0]["geometry"]["location"]["lng"]
forecastUrl = "https://api.darksky.net/forecast/6842c74db30df2e42d7a490dc31acdd3/"+latitude.to_s+","+longitude.to_s
parsed_forecast = JSON.parse(open(forecastUrl).read)

@current_temperature = parsed_forecast.dig("currently","temperature")

@current_summary = parsed_forecast.dig("currently","summary")

@current_temperature = "Replace this string with your answer."
@summary_of_next_sixty_minutes = parsed_forecast.dig("minutely","summary")

@current_summary = "Replace this string with your answer."
@summary_of_next_several_hours = parsed_forecast.dig("hourly","summary")

@summary_of_next_sixty_minutes = "Replace this string with your answer."

@summary_of_next_several_hours = "Replace this string with your answer."

@summary_of_next_several_days = "Replace this string with your answer."
@summary_of_next_several_days = parsed_forecast.dig("daily","summary")

render("meteorologist/street_to_weather.html.erb")
end
Expand Down