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

Commit

Permalink
Documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ellisvalentiner committed Mar 19, 2018
1 parent 2f06192 commit 53d2ec5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
33 changes: 22 additions & 11 deletions src/DarkSky.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 53d2ec5

Please sign in to comment.