diff --git a/src/DarkSky.jl b/src/DarkSky.jl index d7e4273..db1a9c1 100644 --- a/src/DarkSky.jl +++ b/src/DarkSky.jl @@ -40,19 +40,14 @@ end Make a "Forecast Request", returns the current weather forecast for the next week. - forecast(latitude::Float64, longitude::Float64, time::DateTime; verbose::Bool=true, kwargs...) - -Make a "Time Machine Request", returns the observed or forecast weather conditions for a date in -the past or future. - -# Keyword Arguments +# Arguments - `latitude`: the latitude of a location (in decimal degrees). Positive is north, negative is south. - `longitude`: the longitude of a location (in decimal degrees). Positive is east, negative is west. -- `verbose`: whether to display the HTTP request verbosely. -- `exclude`: exclude some number of data blocks from the API response (see the [Dark Sky API documentation](https://darksky.net/dev/docs#forecast-request)). This is useful for reducing latency and saving cache space. -- `extend`: when present, return hour-by-hour data for the next 168 hours, instead of the next 48. -- `lang`: return summary properties in the desired language (see the [Dark Sky API documentation](https://darksky.net/dev/docs#forecast-request)). -- `units`: return weather conditions in the requested units (see the [Dark Sky API documentation](https://darksky.net/dev/docs#forecast-request)). +- `verbose`: whether to display the HTTP request verbosely (optional). +- `exclude`: exclude some number of data blocks from the API response (optional). +- `extend`: when present, return hour-by-hour data for the next 168 hours, instead of the next 48 (optional). +- `lang`: return summary properties in the desired language (optional). +- `units`: return weather conditions in the requested units (optional). """ function forecast(latitude::Float64, longitude::Float64; verbose::Bool=true, exclude::Optional{Array{String}}=nothing, extend::Optional{String}=nothing, @@ -68,6 +63,22 @@ function forecast(latitude::Float64, longitude::Float64; verbose::Bool=true, end _get_json(url, verbose) end + +""" + forecast(latitude::Float64, longitude::Float64, time::DateTime; verbose::Bool=true, kwargs...) + +Make a "Time Machine Request", returns the observed or forecast weather conditions for a date in +the past or future. + +# Arguments +- `latitude`: the latitude of a location (in decimal degrees). Positive is north, negative is south. +- `longitude`: the longitude of a location (in decimal degrees). Positive is east, negative is west. +- `time`: the timestamp for a Time Machine Request (optional). +- `verbose`: whether to display the HTTP request verbosely (optional). +- `exclude`: exclude some number of data blocks from the API response (optional). +- `lang`: return summary properties in the desired language (optional). +- `units`: return weather conditions in the requested units (optional). +""" function forecast(latitude::Float64, longitude::Float64, time::DateTime; verbose::Bool=true, extend::Optional{String}=nothing, lang::String="en", units::String="us") @argcheck in(lang, SUPPORTED_LANGS) diff --git a/test/runtests.jl b/test/runtests.jl index 045d5e1..7beb010 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,3 +5,5 @@ response = forecast(42.3601, -71.0589); @test typeof(response) === DarkSky.DarkSkyResponse response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0)); @test typeof(response) === DarkSky.DarkSkyResponse +response = forecast(42.3601, -71.0589, DateTime(2018, 1, 1, 0, 0, 0), lang="es", units="si", exclude=["minutely"]); +@test typeof(response) === DarkSky.DarkSkyResponse