It’s done! I did something!
I had a lot of fun going through the process of my first Flatiron project. I also stressed about it a lot too.
Coming up with the idea to find good wines at reasonable prices was pretty straight forward. I like drinking wine. I don’t like spending too much money!
Now finding a relatively easy website to scrape, that was less fun. I got lucky with www.wines.com. They have an option to search for wines with several parameters, and when you set some, those search parameters reflect in the URL, https://www.wine.com/list/wine/7155?pricemax=20&ratingmin=95. That made my life a lot easier.
Once I had my website, and the idea for my program. I used bundle install for the first time to create my gem, and also using a local environment for the first time. I had a lot of headaches and challenges going from Learn’s IDE to using my own editor and terminal. There was a steep learning curve for my first project, but I received lots of help navigating everything.
Once I had my basic file structure setup, and my file paths sort of working, I created a Notes file to talk myself through what I wanted my program to do, and stubbed out some data to reference, like my website, and some wines that I wanted to later to into wine objects.
Now I had to create my program! I mimicked a lot of what I saw in Avi’s CLI Gem Walkthrough video, and hard-coded as much as I could. I just wanted to see some stuff returning in my terminal! Once I had the basic structure of my program working, and hard-coded I turned to scraping!
Scraping went surprisingly smoothly for me. I was very proud of myself and my ability to identify the correct CSS selectors, and using Pry to make sure everything was returning properly. I felt like a real live programmer!
After my scraper was working the way I wanted, I turned to making my wine objects. Thanks to all the labs we’ve done in our curriculum so far, this was again pretty straight forward.
Then came the fun part! Taking out my hard-coded data, and using real-life wine objects to create my methods and my program. This was basically a classic case of trial and error. Ran into a few snags with some funky returns from while loops and misplaced methods, but eventually got it all sorted out and working! Now I can find anyone some great wine at reasonable prices.
It feels great to create something!