For my CLI Project I wanted to do something food related. I LOVE FOOD! My go-to site for any recipe is Serious Eats. They have the most amazing tasting foods. Seriously!
The homepage for Serious Eats is a bit busy. There are podcasts, videos, buying guides, techniques, ads, etc. I found a page within the Serious Eats site that focuses on their recipe book - The Food Lab - which is a much cleaner site to view recipes.
I created three classes:
- class
Scraper
- responsible for scraping the website for all the recipes and for scraping the selected recipe website for their attributes. - class
Recipe
- main model representing an individual recipe. - class
CLI
- responsible for interacting with the user, starting and ending the application.
The application:
When the application starts, it fetches the index view and scrapes the list of recipes. It then displays these recipes as a numbered list menu for the user to choose from. Once the user selects a valid number from the list, that recipe’s url is fetched and the complete details of the recipe are parsed into a recipe object. Then it prints the details of the recipe - a description, portion amount, active cooking time, total time, rating, ingredients, instructions and website. The application will then ask the user if they would like to see another recipe.
If yes, the list of recipes will be displayed again and the user will be able to browse the selections. If no, a friendly goodbye message is displayed.
Application Links:
https://rubygems.org/gems/serious-eats
https://github.com/cookiemccormick/serious-eats