class Weatherbot::CLI
CLI
Controller
Public Instance Methods
call()
click to toggle source
# File lib/cli.rb, line 6 def call puts " __ __ ___ ___ __ __ __ | | | || | | | | | | |_| | | |_| || | | | |__| | | | || | | | | | | || | ___ | | | | | _ || | |_ | | | | ||_|| | |__| |__||___| |_| |___| |_| |_| _ _ _______ _______ _______ __ __ _______ ______ _______ _______ _______ __ | | _ | || || _ || || | | || || _ | | _ || || || | | || || || ___|| |_| ||_ _|| |_| || ___|| | || | |_| || _ ||_ _|| | | || |___ | | | | | || |___ | |_||_ | || | | | | | | | | || ___|| | | | | || ___|| __ || _ | | |_| | | | |__| | _ || |___ | _ | | | | _ || |___ | | | || |_| || | | | __ |__| |__||_______||__| |__| |___| |__| |__||_______||___| |_||_______||_______| |___| |__| " sleep(1) intro menu end
display_previous()
click to toggle source
# File lib/cli.rb, line 107 def display_previous Weatherbot::API.locations.map { |entry| puts entry.location_name } end
display_weather(weather)
click to toggle source
# File lib/cli.rb, line 92 def display_weather(weather) puts "\n\nReport Time: #{weather.report_time}" puts "Location: #{weather.location_name}, #{weather.country}" puts "Coordinates: #{weather.coordinates}" puts "Google Maps: #{weather.google_maps}" puts "\nTemperature: #{weather.temp_avg}ºF / #{weather.temp_celsius}ºC" puts "Condition: #{weather.condition.capitalize}" puts "Cloudiness: #{weather.cloudiness}%" puts "\nHumidity: #{weather.humidity}%" puts "Wind Speed: #{weather.wind_speed} mph" puts "Wind Direction: #{weather.wind_direction}" puts "\nSunrise: #{weather.sunrise}" puts "Sunset: #{weather.sunset}" end
intro()
click to toggle source
# File lib/cli.rb, line 30 def intro puts "\n\nI'm a command line interface Ruby gem that gives you current and forecast weather for any location in the world!\n\n" end