From 86601c5b1cc57bc7923707031d0b757ea85eb7ce Mon Sep 17 00:00:00 2001 From: Ellis Valentiner Date: Mon, 13 Aug 2018 15:55:01 -0400 Subject: [PATCH] Remove v1.0 deprecations --- .travis.yml | 2 +- REQUIRE | 4 ---- src/DarkSky.jl | 20 +++++++++++++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) delete mode 100644 REQUIRE diff --git a/.travis.yml b/.travis.yml index 54c38ec..a715754 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ os: - linux - osx julia: - - 0.7 + - 1.0 - nightly matrix: allow_failures: diff --git a/REQUIRE b/REQUIRE deleted file mode 100644 index 7dd8c3f..0000000 --- a/REQUIRE +++ /dev/null @@ -1,4 +0,0 @@ -julia 0.6 -ArgCheck -HTTP -JSON diff --git a/src/DarkSky.jl b/src/DarkSky.jl index 422f580..47859c8 100644 --- a/src/DarkSky.jl +++ b/src/DarkSky.jl @@ -1,4 +1,4 @@ -VERSION >= v"0.7.0" && __precompile__() +VERSION >= v"1.0.0" && __precompile__() module DarkSky @@ -26,7 +26,21 @@ struct DarkSkyResponse alerts::Optional{Array} flags::Optional{Dict} end -DarkSkyResponse(x::Dict) = DarkSkyResponse((get.(x, String.(fieldnames(DarkSkyResponse)), nothing))...) +# DarkSkyResponse(x::Dict) = DarkSkyResponse((get.(x, String.(fieldnames(DarkSkyResponse)), nothing))...) +function DarkSkyResponse(x::Dict) + DarkSkyResponse( + get(x, "latitude", nothing), + get(x, "longitude", nothing), + get(x, "timezone", nothing), + get(x, "offset", nothing), + get(x, "currently", nothing), + get(x, "minutely", nothing), + get(x, "hourly", nothing), + get(x, "daily", nothing), + get(x, "alerts", nothing), + get(x, "flags", nothing) + ) +end Dict(x::DarkSkyResponse) = Dict(String(f) => getfield(x, f) for f in fieldnames(typeof(x)) if getfield(x, f) != nothing) Base.convert(Dict, x::DarkSkyResponse) = Dict(x) @@ -44,7 +58,7 @@ end function _get_json(url::String, out_type::String, verbose::Bool) response = HTTP.get(url) - verbose ? @info(response) : nothing + verbose ? info(response) : nothing if response.status == 200 out = JSON.Parser.parse(String(response.body)) if out_type == "DarkSkyResponse"