Steam Upcoming Gem

The Project

I consider the Steam Upcoming gem to be my first legitimate project in Ruby – creating a Command Line Interface (CLI) gem from scratch! It was also my first opportunity to code an application using a Git and test driven workflow.

I decided to use Steam’s Upcoming Games page as the basis for my gem – the Steam Upcoming Gem, which scrapes that page for a list of upcoming games on the Steam platform and allows the user to drill down into more information about each game.

steam-upcoming-gem-terminal

 The Process

I started the process of building the Steam Upcoming Gem by analyzing what my requirements should be. The listed requirements were:

– Deliverable must be packaged as a gem
– Deliverable must provide a CLI on gem installation 
– The CLI gem must provide data from an external source, such as via scraping or an API
– Data provided must go at least a level deep, generally by showing the user a list of available data and then being able to drill down into a specific item

I initially considered using an API but decided to gather the information via scraping as I am currently more experienced with that (though I love a good challenge!). I then had to decide what I was going to build. I knew I wanted to do something different, interesting, and challenging.

I settled on scraping information from Steam, a popular online platform with a massive online catalog of games for purchasing, playing, and sharing.  While not an avid gamer anymore, I do enjoy playing video games when I have the time and figured this would be a fun project to work on that might be useful as well (my wallet might disagree).

The next step was to define what information the gem would scrape and what functionality it would have. I settled on the following information to start, though I did want to do more:

– Game name
– Release date
– Platform (Windows, Mac, Steamily, Linux , etc)
–  Tags
– About – description
– Details – other info about the game (single player, multi player, VR support, etc.)

After defining the information I wanted to capture, I started coding my classes, methods and tests.

Revisions

Once I had a basic CLI application working , I started to do some refactoring. One of the major issues I identified was the application load time – up to 15 seconds to load the results! The original code I wrote would scrape the index page, create the game objects and list, and would also create all the attributes for all the games before finally displaying the list. I realized this was terribly inefficient and decided to refactor my code so the gem would only create and display a game’s attributes when it was selected by the user. This greatly improved performance and decreased the load time from 15 seconds to about 1 – 2 seconds (depending on Internet connectivity speed).

I also added in some of the functionality I thought would be in version two – the ability for users to load additional pages of results and a page tracker so the user knows what page they’re on while sifting through the results. I also added error messages for users if their input is invalid.

Finishing Touches and Wrap Up

At the end of the project, I reviewed all my code again to add comments and simplify the code where necessary (eg removing unnecessary lines of code and any simple refactoring). I also used the Colorize Gem to add color to the gem and make it more visually interesting.
Check out the Steam Upcoming gem on Github and Ruby Gems.


 

Thoughts for version 2

  • Ability to sort the results by Release Date, Name, Lowest Price, Highest Price, and User Reviews.
  • Include the total number of upcoming games when the gem loads.
  • Refactor the “page” command so a user can type “page [page_number]” instead of the page command, then the number separately.

 

Suggestions for the Steam Upcoming Gem? Leave them in the comments or shoot me an email at mail@mattcassara.com.

Leave a Reply

Your email address will not be published. Required fields are marked *