My First Portfolio Project Using Ruby.

Adam Workman
4 min readJul 4, 2020

--

I am currently a student at Flatiron for software development. For my fist portfolio project, I was tasked with creating a CLI (command line interface). I chose to build a simple program that gives the user up to date COVID-19 statistics by country. This project has brought me a higher understanding of the concepts that I have been working on over the past 3 weeks.

The program begins with showing the user a bit of text from the CDC website, and asks the user for input (just a press of the “Enter” button) to continue. From here the user is given the current global statistics, and is asked to input a country to get the information on that specific country. The user is then given a list of the current stats for the requested country and is presented with a menu for further input.

From here the user can select an option and the program with return to them the requested information, or they can choose to exit the program by selecting “Exit”. Pretty simple… Lets take a look at how it works.

This little bit of code is where all of the outside information finds its way into the program. It is able to take information from the web via the class constant “URL”. Two methods are defined here, get_country_status and get_global_status…. They do exactly what is sounds like… when these methods are called. They will create an instance of CountryStatus and GlobalStatus respectively(we will get to that soon), and sort through the information they are given from “URL”. They send that information to CountryStatus and GlobalStatus classes so that it can return that information to the user when the user asks for it. This is what the data looks like when the program receives it from “URL”.

Nice and neat right? From here the data goes to its respective class. The CountryStatus class stores the information for the countries, and the GlobalStatus class stores the global statistics.

Sweet… the program has all of the information it needs. Now how does it take that information and present it to the user when the user asks for it? That is done via the CovidCLI class. This class is where the magic happens.

When a new instance of the CovidCLI class is made, it tells the API class ( the one that pulls information from the web) to do it’s thing and get that info. The info gets sorted and stored, and is made available to use. This is also where the program shows the user input and presents the user with information. Pretty cool…

That is a basic overview of how this program works… There are lots of other things going on as well, like an environment file that not only makes sure the other files have a line of communication, but also acts as a central place to require dependencies… and console file that gets everything up and running… and obviously lots of code to make everything understandable and user friendly. It’s crazy that after only three weeks of learning, I am able to build a program… It’s a simple program, but it works and I built it!

--

--

Adam Workman
Adam Workman

Written by Adam Workman

◄◄Software Engineer►► ◄◄Web Developer►►

No responses yet