Hockey_Orgs CLI Project

Mike Wilder
2 min readDec 13, 2020

Well this was quite a journey. Just about two weeks into my online software-engineering course at flatiron I’ve finally completed my first project! We were assigned to use Ruby to create a CLI app that would scrape data off an online source and allow users to ask it some questions. When I started thinking about a data set I’d like to explore hockey came to mind immediately. For most of the last decade I’ve been an obsessive hockey fan and for most of my life, at least since I read Moneyball in middle school, I’ve been generally interested in sports statistics. I knew I wouldn’t be able to do any hard-hitting analysis with the limited skills I have but I figured I could think of something that would meet the project requirements while also letting me work with information I’m interested in.

My first step was finding an API related to the NHL to work with, aside from typing the title for this blog post, was probably the easiest part of the project. A google search for “NHL API” turned up exactly what I was looking for and, lo and behold, it was also included in Flatiron’s list of recommended data sources. Now that I had an API selected it was time to do…something. I really didn’t have a clue what. In my time at flatiron I had learned a lot but I hadn’t learned how to sit down, come up with an idea and code it out. I had to learn how to work without the guiding hand of the Learn IDE.

At first I was terrified to be out on my own but after watching the video of Avi making his Daily Deals gem and coding along with it, I started to feel the pieces come together. All the time I spent completing labs, all the pieces of code that I wrote despite not entirely understanding their purpose and all of the nights I went to sleep thinking about attribute accessors started to pay off. I pieced together a scraper class to get the data I needed to start my project, did a lot of work and a lot of swearing at my computer and eventually got my Org class to instantiate the 31 organizations I needed in order to start asking some questions.

I decided that I wanted users to be able to find out the arena name, year of founding and division of the teams they chose. Writing those methods was simple enough once I had instantiated the classes properly but as I ran my program I found myself wondering which teams were founded in the same year so I decided to see if I could write a function for that. Overall it took a lot of trial and error but at the end of the day, while it wasn’t exactly pretty, I had a working gem that presented the information in a clean way.

--

--