MLS CLI Data Project

Ah! I finally reached the dreaded first project, CLI Data Gem Project. I started Flatiron’s Online Web Developer Program about 6 weeks ago, and even though I enjoyed the journey so far, I was getting hesitant on reaching this point. The Object Oriented labs were increasing in difficulty (Collaborating Objects lab), and now I had to develop a project from scratch. It’s a lot more intimidating than it sounds. Fortunately, this project turned out exactly how I planned it, and I had loads of fun.

In this project, we are required to create a Command Line Interface (CLI) that scrapes data from a website, and displays it going at least one level deep in the CLI. My decision on what data to scrape wasn’t difficult, and an instructor from a study group answered this perfectly: “You’ll want to choose something that you enjoy very much, because it will restrain you (a little less) from throwing your computer across the room when you get frustrated that your code isn’t working.” Wise words, I may say.

I’m a huge fan of soccer, and immediately knew that my project was going to be soccer based. I have been following the American league, MLS for about 9 years now, so I decided to scrape the league table for the current season.

MLS 2017 Eastern Conference Standings Table

This was perfect! I grabbed a piece of paper and drew out my user interface. My plan was to prompt for which conference to display, and then list the teams in their current position on the table, followed by being able to select a team and drill down to their wins-losses-ties record.

After watching Avi’s video on the Daily Deal project, I decided to set up my file structure with Bundler. Once, that was done, it was time to code, *sigh*.

The most difficult part was choosing what selectors and tags would encapsulate all of my data when using Nokogiri. After about 5–6 hours of researching and testing on pry, I was able to get it to work.


I collected every team and it’s attributes into a hash and pushed that into an array. This array is then passed into the create_teams method, which collects each individual team from the array and turns them into instances of the Team class.

With all of teams all initialized as Team instances, all I had to focus on was the user interface. CLI walkthrough:

Main Menu / Conference Select
Scraped MLS Eastern Conference Standings
Drilling down into NY Red Bulls season record

Overall, I can say that project has been very fun, and I feel like I have a new understanding and appreciation to the beauty of code especially when starting from scratch.