mirror of
https://github.com/elisspace/FxLifeSheet.git
synced 2026-08-29 15:44:00 +00:00
Weather bugfixes
This commit is contained in:
@@ -63,6 +63,11 @@ module Importers
|
||||
request["x-rapidapi-key"] = ENV.fetch("RAPID_API_KEY")
|
||||
response = http.request(request)
|
||||
parsed_json = JSON.parse(response.read_body)
|
||||
if parsed_json["locations"].nil?
|
||||
puts "ran out of weather API quota..."
|
||||
binding.pry
|
||||
return
|
||||
end
|
||||
add_to_weather_cache(id, parsed_json)
|
||||
store_weather_in_db(weather: parsed_json, matched_date: matched_date)
|
||||
end
|
||||
@@ -85,7 +90,6 @@ module Importers
|
||||
"Humidity" => "humidity",
|
||||
"SolarRadiation" => "solarradiation",
|
||||
"WindSpeed" => "wspd",
|
||||
"WindSpeed" => "wspd",
|
||||
"SeaLevelPressure" => "sealevelpressure",
|
||||
}.each do |key, value|
|
||||
insert_weather_row(key, weather.fetch(value), matched_date, type: "number")
|
||||
|
||||
Reference in New Issue
Block a user