View Source Weather.Opts (Weather v0.3.8)

The Weather.Opts struct.

Fields:

  • :appid - a string representing the OpenWeatherMap API key.

  • :colors - a boolean representing whether or not to colorize the output of the hourly report. Defaults to true.

  • :color_codes - a map representing temperature color codes. Defaults to Weather.Colors.default_color_codes/0.

  • :every_n_hours - an integer representing the hour interval at which data is reported for the hourly report. Defaults to 3.

  • :feels_like - a boolean representing whether to show the "feels like" temperature instead of the actual temperature. Defaults to false.

  • :hide_alerts - a boolean representing whether to hide weather alerts, even when alerts are available. Defaults to false, which shows alerts if there are any available.

  • :alert_titles_only - a boolean representing whether to show only the titles of weather alerts. Defaults to false, which shows titles along with full alert descriptions.

  • :hours - an integer representing the number of hours to report on for the hourly report. Defaults to 12. Max is 48.

  • :latitude - a float representing the latitude of your location.

  • :longitude - a float representing the longitude of your location.

  • :test - a string representing the type of fake weather data to return for testing purposes. Options are "clear", "rain", "storm".

  • :twelve - a boolean representing whether to use 12-hour time format for the hourly report. Defaults to true. When false, 24-hour time format is used.

  • :units - a string representing the units of measurement. Default is "imperial" (Fahrenheit). Other options are "metric" (Celsius) and "standard" (Kelvin).

  • :label - An optional string representing the name of the location for which weather data is being fetched. If present, the report will include the label in the output. If not provided but a zip code is provided, the label will be set to the name of the location associated with the zip code.

Summary

Functions

Create a new Weather.Opts struct, applying defaults where necessary.

Types

@type parsed_arg() ::
  {:api_key, String.t()}
  | {:colors, boolean()}
  | {:color_codes, String.t() | Weather.Colors.codes()}
  | {:every, integer()}
  | {:hide_alerts, boolean()}
  | {:feels_like, boolean()}
  | {:alert_titles_only, boolean()}
  | {:hours, integer()}
  | {:latitude, float()}
  | {:longitude, float()}
  | {:test, String.t()}
  | {:twelve, boolean()}
  | {:units, String.t()}
  | {:zip, String.t()}
@type parsed_args() :: [parsed_arg()]
@type t() :: %Weather.Opts{
  alert_titles_only: boolean(),
  appid: String.t(),
  color_codes: Weather.Colors.codes(),
  colors: boolean(),
  every_n_hours: integer(),
  feels_like: boolean(),
  hide_alerts: boolean(),
  hours: integer(),
  label: String.t(),
  latitude: float(),
  longitude: float(),
  test: String.t(),
  twelve: boolean(),
  units: String.t()
}

Functions

@spec new(parsed_args()) :: t()

Create a new Weather.Opts struct, applying defaults where necessary.