Getting the Weather on a Ruby CLI App

The first project I built as a developer was a CLI application named Zoonie Weather that got real-time weather data by city from an API. OpenWeatherMap provides multiple API services that include current weather data, weather forecasts, and historical data. This was the first time I had worked with an API, and I'm proud of what my project partner and I had accomplished in just a few days of work. It combined our knowledge of Ruby, ORM, and ActiveRecord...and it seemed like such daunting work at the beginning. Staring at a blank VS Code editor was one of the most intimidating experiences I've ever had.

via GIPHY

Welcome to Zoonie Weather

The app opens up to our welcome page.

zoonie_welcome.png

I used the Figlet and Colorize gems to give some design elements to the terminal output. Another useful gem is TTY::Prompt which gives great options to display prompts or menus that can be used to easily interact with the application.

The user inputs the username and is asked if they would like to get the weather from their favorite cities list or if they would like the weather from another city.

username.png

If the user chooses to get the weather from their favorites list, the output will show the current temperature and weather conditions for the cities that are saved as favorites. The user also has the option to update the favorites list by adding a city or deleting a city. Here, the user is adding a city, along with a comment.

update.png

The user has now updated the favorite cities list, and it is displayed along with the comment for each city.

updatedlist.png

At the end, the user is prompted to continue using the app or to exit out.

What I Learned

A lot! The CLI project was challenging but the process of building it solidified many of the concepts that I learned in the past 2-3 weeks. I was introduced to new Ruby gems that made the project much more fun to work with. If I had more time, I would love to add more functionality to the project, like getting the hourly forecast and 7-day forecast for each city.