class OpenWeatherClient
Attributes
city[R]
Public Class Methods
new(city)
click to toggle source
# File lib/open_weather_client.rb, line 4 def initialize(city) @city = city end
Public Instance Methods
call()
click to toggle source
# File lib/open_weather_client.rb, line 8 def call Decorators::OpenWeatherResponse.new(weather_data) end
Private Instance Methods
location_url()
click to toggle source
# File lib/open_weather_client.rb, line 22 def location_url "api.openweathermap.org/data/2.5/weather?q=#{city}&appid=#{ENV['OPEN_WEATHER_API_KEY']}" end
weather_data()
click to toggle source
# File lib/open_weather_client.rb, line 16 def weather_data Retryable.retryable(tries: 5) do @weather_data ||= RestClient.get(location_url) end end