18
Wine Spectator's Top 100 Wines - Ruby CLI Project
For the first project in Flatiron School's Software Engineering Bootcamp, students are asked to build a Command Line Interface (CLI) to an external data source. The CLI should be composed of an Object Oriented Ruby application, and demonstrate knowledge gained during the Ruby Module of the program.
For my project, I scraped data from Wine Spectator's list of Top 100 Wines of 2020 and created an app that allows users to interact with the information provided.
Being that this was my first full-scale project build, I spent a considerable amount of time in the planning phase. I studied the requirements, watched live build videos, and explored code from other projects to visualize how I wanted to structure my own.
REQUIREMENTS
- Provide a CLI
- CLI application must provide access to data from a web page
- The data provided must go one level deep - where a user can make a choice and receive detailed information on their selection
- Use strong Object Oriented design patterns - data should be stored in a collection of objects, not hashes
OUTLINE
The goal of the Top 100 Wines CLI App is to output a numbered list of wines by rank, allow the user to select a wine that they're interested in, provide the details of that wine, and then either loop back to the list or exit the program based on user input.
![](https://res.cloudinary.com/practicaldev/image/fetch/s--Fx2r2VBJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/79oweuhqvnaizzqgxuvo.png)
After creating the skeleton of my application (bin files, gemspec, environment, etc.), I focused on the structure and responsibilities of my Class files.
SCRAPER CLASS
The Scraper Class is responsible for scraping data from the Wine Spectator website.
WINE CLASS
The Wine Class is responsible for creating and storing wine objects.
CLI CLASS
The CLI Class is responsible for all operational functionality. In addition to listing the wines numerically by rank, I implemented a method asking the user which group of wines they would like to view in intervals of 20. I also utilized the Colorize gem to add some visual depth to the program.
The video below demos the app at runtime.
![](https://res.cloudinary.com/practicaldev/image/fetch/s--_YbcbqzV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/http://img.youtube.com/vi/ClrY_aHCvmQ/0.jpg)
[cover photo by Mathilde Langevin on Unsplash]
18