43
loading...
This website collects cookies to deliver better user experience
def self.api_location(unit)
response = HTTParty.get("https://api.openweathermap.org/data/2.5/weather?lat=#{lat}&lon=#{lon}&appid=#{ENV['API_KEY']}&units=#{unit}")
data = JSON.parse(response.body, symbolize_names: true)
@weather_today = self.new
@weather_today.location = data[:name]
@weather_today.time = Time.at(data[:dt])
@weather_today.temp = data[:main][:temp].to_i
def self.select_name(units, location)
response = HTTParty.get("http://api.openweathermap.org/data/2.5/weather?q=#{location}&appid=#{ENV['API_KEY']}&units=#{units}")
data = JSON.parse(response.body, symbolize_names: true)
@weather_today = self.new
@weather_today.response_code = data[:cod]
if @weather_today.response_code === "404"
spinner = TTY::Spinner.new("[:spinner] cod")
spinner.error("404")
return
else
@weather_today.location = data[:name]
Check the current weather and Forecast for the next 5 days at any city you name in the world plus a link to the city location on Google Maps. It only will work with city names.
It gives you 3 unit system to choose from:
Read and open in your browser the latest world headlines from BBC News.
Gives you a funny quote according to weather conditions courtesy of the AUTHENTIC WEATHER APP.
Also a Big GoodBye.
class WeatherToday::CLI
$prompt = TTY::Prompt.new(active_color: :cyan)
def call
welcome
end
def welcome
puts Rain.go
puts Intro.go
sleep (3)
puts"
.-. .-. ,---. ,-. ,-. .---.
| | | | | .-' | | | | / .-. )
| `-' | | `-. | | | | | | |(_)
| .-. | | .-' | | | | | | | |
| | |)| | `--. | `--. | `--. \ `-' /
/( (_) /( __.' |( __.' |( __.' )---'
(__) (__) (_) (_) (_)
".colorize(:cyan)
units_selection
puts ''
puts "World's News"