NOAA.Observations.URLTemplates (NOAA Observations v0.4.37) View Source

Returns a URL based on url_templates and station or state.

Link to this section Summary

Functions

Returns a URL based on url_templates and station or state.

Link to this section Functions

Link to this function

url(url_templates, list)

View Source

Specs

url(Keyword.t(), Keyword.t()) :: String.t()

Returns a URL based on url_templates and station or state.

Parameters

  • url_templates - keyword of EEx strings
  • keyword - [station: station] or [state: state]

Examples

iex> alias NOAA.Observations.URLTemplates
iex> url_templates = [
...>  state: "w1.weather.gov/seek.php?state=<%=state%>&Find=Find",
...>  station: "w1.weather.gov/display.php?stid=<%=station%>"
...> ]
iex> {URLTemplates.url(url_templates, state: "vt"),
...>  URLTemplates.url(url_templates, station: "KBTV")}
{"w1.weather.gov/seek.php?state=vt&Find=Find",
 "w1.weather.gov/display.php?stid=KBTV"}

iex> alias NOAA.Observations.URLTemplates
iex> url_templates = [
...>   state: "weather.gc.ca/forecast/canada/index_e.html?id=<%=state%>"
...> ]
iex> URLTemplates.url(url_templates, state: "qc")
"weather.gc.ca/forecast/canada/index_e.html?id=qc"