class Services::Application::WeatherByAddress::Result
WeatherByAddress Result
Thin wrapper returned by WeatherByAddress#call. Delegates weather fields to WeatherAtLocation and adds per-adapter source tracking (:api_response / :cached_response).
Example
result = Services::Application::WeatherByAddress.new.call("São Paulo") result.location.latitude # => -23.55 result.current_weather # => CurrentWeather result.from_cache?(:geocode) # => false result.sources[:current_weather] # => :api_response
Attributes
Public Class Methods
Source
# File app/services/application/weather_by_address/result.rb 27 def initialize(weather_at_location:, sources:) 28 @weather_at_location = weather_at_location 29 @sources = sources.freeze 30 freeze 31 end
Public Instance Methods
Source
# File app/services/application/weather_by_address/result.rb 33 def from_cache?(key) 34 sources[key] == :cached_response 35 end