Creating my first my first project with Flatiron School


Phew.. I finally made it to the my first CLI gem project with Flatiron School’s Software Engineering program. I was juggling some things in person life, so, I decided to switch for a part-time cohort to the self-paced program with Flatiron. Ultimately, I do think it was the best decision for me. I am enjoying the flexibility of the self-paced program because I am married and a parent to a toddler. It gives me the freedom to maintain all aspects of my life while continuing to develop my skills in coding. (Here’s the link to my github for this project.)

Starting my Ruby CLI gem

When I started to brainstorm about my CLI gem, I was having a hard time coming up with new ideas. My cohort-lead, at the time, strongly urged us to think outside of the box and try and come up with something unique. Originally, I wanted to create a gem that when a user gave their input to a series of questions, it would return a brewery based on the user’s input in the Sonoma County in California. I wanted to use an API. I found one that I thought would work, but I required an auth token and I wasn’t comfortable trying to take that on for this project since it wasn’t something we covered in the curriculum thus far. After getting pretty far with my project, I decided to scratch that idea and scrape a webpage instead of using an API. I was worried about scraping since the data could potential change which could cause my program to break, but I decided it was worth the risk because I understood scraping a bit more than using an API. I stumbled upon a blog about some of the best coffee spots in Sonoma County so I decided that was the site I wanted to use! It was a relatively simple webpage and I love me some coffee so I was excited to use this site.

I have three classes in my CLI gem (CLI, Scraper, and Shop). My CLI or command-line interface is responsible for how the user interacts with my program. I wanted my user to be able to pick a coffee shop they wanted more information about and it would return just one coffee shop. I decided to loop the menu method so they user would get more information as many times as they wanted or they had to choose to the exit the program before it quit.

Scraper Class

The biggest issue I had what creating my gem was getting the correct output for what data I wanted to use from my Scraper class. Originally, I created two methods in my Scraper class because I couldn’t figure out how to make everything work with just one method. Ultimately, I was able to refactor my scraper class to just one method but using the correct CSS selectors and it made my program faster and more efficient. I was able to refactor my CLI class so it wasn’t hard-coded and I am happy with how it turned out.

I figured out that ‘div.content’ returned the entire blog post, and ‘div.field__item’ added after returned the name, address, and number of coffee shops. After, adding the css selector ‘h4’ it returned only the name of the coffee shop.

CLI Class

Creating my CLI class was the easiest part for me. I’m a very literal person and I can struggle with thinking abstractly so creating the methods and seeing the results right away was helpful. Whenever I created a new method I would just output some fake data to make sure the method did what I wanted it to do and then I would change out the data to work with the Scraper or Shop Class. For example, here’s how my list_shops method started:

and then whenever I got my Scraper class working with my Shops class, I was able to iterate over my SocoCoffee::Shops.all and return each coffee shop name.

In addition, the my most complex method in my CLI was my menu method.

I used the SocoCoffee::Shops.all.size to make sure the user’s input wasn’t greater then the amount of coffee shops and if it was, the user would receive an error and be required to input a valid answer.


To end with, I am happy to have finished my first project at Flatiron School. I am so amazed at what I have learned thus far. I can’t wait to see what is next!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store