class MexWeather::Weather
$weather_calculator = -> (city){ HTTParty.get(“api.openweathermap.org/data/2.5/weather?q=#{city},mx”).parsed_response[“main”]}
Public Class Methods
get_weather_for(city)
click to toggle source
# File lib/mex_weather.rb, line 10 def self.get_weather_for(city) weather = @@weather_calculator.call city { actual: weather["temp"] - 273.15, maxima: weather["temp_max"] - 273.15, minima: weather["temp_min"] - 273.15 } end