Forecastr (forecastr v0.3.0)

Forecastr is an application that queries the Open Weather Map API

The Forecastr user API is exposed in this way:

Query the backend weather API for today's weather

Forecastr.forecast(:today, query, renderer: Forecastr.Renderer.ASCII )

Query the backend weather API for the forecast in the next days

Forecastr.forecast(:next_days, query, renderer: Forecastr.Renderer.ASCII )

For example:

Forecastr.forecast(:today, "Berlin")

Forecastr.forecast(:next_days, "Berlin", units: :imperial)

Forecastr.forecast(:today, "Lima", units: :imperial, renderer: Forecastr.Renderer.PNG)

Summary

Types

@type renderer() ::
  Forecastr.Renderer.ASCII
  | Forecastr.Renderer.ANSI
  | Forecastr.Renderer.HTML
  | Forecastr.Renderer.JSON
  | Forecastr.Renderer.PNG
Link to this type

when_to_forecast()

@type when_to_forecast() :: :today | :next_days

Functions

Link to this function

forecast(when_to_forecast, query, params \\ [units: :metric])

@spec forecast(when_to_forecast(), query :: String.t(), params :: Keyword.t()) ::
  {:ok, binary()} | {:ok, [binary()]} | {:error, atom()}

Forecastr.forecast(:today, "Berlin")

Forecastr.forecast(:today, "Mexico city", renderer: Forecastr.Renderer.ANSI)