Skip to content
This repository has been archived by the owner on Jan 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #6 from ellisvalentiner/fix-time-machine-request
Browse files Browse the repository at this point in the history
  • Loading branch information
ellisvalentiner committed Mar 25, 2018
2 parents b0e2fd0 + 5e4e374 commit 631cebf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/DarkSky.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ end
DarkSkyResponse(x::Dict) = DarkSkyResponse((get.(x, String.(fieldnames(DarkSkyResponse)), nothing))...)

function Base.show(io::IO, x::DarkSkyResponse)
print(io, (x.latitude, x.longitude), "\n" * x.daily["summary"])
print(io, (x.latitude, x.longitude))
end

for fieldname in fieldnames(DarkSkyResponse)
Expand Down Expand Up @@ -95,7 +95,7 @@ function forecast(latitude::Float64, longitude::Float64, time::DateTime; verbose
exclude::Optional{Array{String}}=nothing, lang::String="en", units::String="us")
@argcheck in(lang, SUPPORTED_LANGS)
@argcheck in(units, SUPPORTED_UNITS)
url = "https://api.darksky.net/forecast/$(ENV["DARKSKY_API_KEY"])/$latitude,$longitude?lang=$lang&units=$units"
url = "https://api.darksky.net/forecast/$(ENV["DARKSKY_API_KEY"])/$latitude,$longitude,$time?lang=$lang&units=$units"
if !(exclude === nothing)
url = "$url&exclude=$(join(exclude, ","))"
end
Expand Down
5 changes: 3 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ if haskey(ENV, "DARKSKY_API_KEY")
info("Dark Sky API key was found in your system environment variables, running tests...")
@test isa(forecast(42.3601, -71.0589), DarkSky.DarkSkyResponse)
@test isa(forecast(42.3601, -71.0589, exclude=["currently"], extend="hourly"), DarkSky.DarkSkyResponse)
response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0));
response = forecast(42.3601, -71.0589, DateTime(2018, 3, 7, 0, 0, 0));
@test isa(response, DarkSky.DarkSkyResponse)
@test latitude(response) === 42.3601
@test longitude(response) === -71.0589
@test timezone(response) == "America/New_York"
@test isa(currently(response), Dict{String, Any})
@test isa(minutely(response), Dict{String, Any})
@test isa(minutely(response), Void)
@test isa(daily(response), Dict{String, Any})
@test isa(alerts(response), Array{Any, 1}) | isa(alerts(response), Void)
@test isa(flags(response), Dict{String, Any})
@test isa(print(response), Void)
@test isa(forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0), lang="es", units="si", exclude=["minutely"]), DarkSky.DarkSkyResponse)
else
warn("Dark Sky API key was not found in your system environment variables, skipping tests...")
Expand Down

0 comments on commit 631cebf

Please sign in to comment.