Class: OpenMeteo::Forecast
- Inherits:
-
Object
- Object
- OpenMeteo::Forecast
- Defined in:
- lib/open_meteo/forecast.rb,
lib/open_meteo/forecast/variables.rb
Overview
Perform a forecast request to the OpenMeteo API.
Defined Under Namespace
Classes: ForecastModelNotImplemented, Variables, WrongLocationType
Instance Method Summary collapse
- #get(location:, variables:, model: :general) ⇒ Object
-
#initialize(client: OpenMeteo::Client.new, response_wrapper: OpenMeteo::ResponseWrapper.new) ⇒ Forecast
constructor
A new instance of Forecast.
Constructor Details
#initialize(client: OpenMeteo::Client.new, response_wrapper: OpenMeteo::ResponseWrapper.new) ⇒ Forecast
Returns a new instance of Forecast.
15 16 17 18 |
# File 'lib/open_meteo/forecast.rb', line 15 def initialize(client: OpenMeteo::Client.new, response_wrapper: OpenMeteo::ResponseWrapper.new) @client = client @response_wrapper = response_wrapper end |
Instance Method Details
#get(location:, variables:, model: :general) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/open_meteo/forecast.rb', line 20 def get(location:, variables:, model: :general) ensure_valid_location(location) model_definition = get_model_definition(model) variables_object = OpenMeteo::Forecast::Variables.new(**variables) get_forecast(model_definition[:endpoint], location, variables_object) end |