Method: Weatherb::API#realtime

Defined in:
lib/weatherb/api.rb

#realtime(lat:, lon:, unit_system: 'si', fields: DEFAULT_FIELDS | DEFAULT_REALTIME_FIELDS) ⇒ Hash

Realtime (<= 1min out) The realtime call provides observational data at the present time, down to the minute, for a specific location. Information is available globally, with high-resolution data available for Japan Western Europe, India, and the US.

Parameters:

  • lat (Float)

    Latitude, -59.9 to 59.9.

  • lon (Float)

    Longitude, -180 to 180.

  • unit_system (String) (defaults to: 'si')

    Unit system, “si” or “us”.

  • fields (Array<String>) (defaults to: DEFAULT_FIELDS | DEFAULT_REALTIME_FIELDS)

    Selected fields from ClimaCell data layer (such as “precipitation” or “wind_gust”).

Returns:

  • (Hash)


93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/weatherb/api.rb', line 93

def realtime(lat:, lon:, unit_system: 'si', fields: DEFAULT_FIELDS | DEFAULT_REALTIME_FIELDS)
  path = 'weather/realtime'

  query = {
    apikey: @api_key,
    lat: lat,
    lon: lon,
    unit_system: unit_system,
    fields: fields
  }

  response = @connection.get(path, query)
  response_body(response)
end