My First CLI Project Gem

Kizito Njoku
3 min readMay 20, 2020

Posted by Kizito Njoku on December 13, 2019

Project name Easy_Cars

First and for most, it has been a journey. To get started with this project I approached it wrong in many ways. The first thing I did wrong was gathered all the gems I needed and did not test them. Second, I started thinking too far ahead and programmed what I believe should work. Last, was grabbing the wrong websites, which lead to more problems over time.

Not Testing Gems First!

After, gathering all the gems I needed I did not test them to see if they were working. Big mistake, when I thought I had a good amount of code on my project, I decided to go ahead test it out to see if everything was working and this is what I got.

It didn’t take me long to realize that some gems needed to be updated for others to cooperate, but it did take a while for me to figure out that my lines of code aren’t correct. This led to the next problem I ran into, which was thinking too deeply about what is wrong with my code.

Thinking Too Far Ahead!

As I was updating each of the gems, I also was thinking of more ideas to add to the project. This was good for me to an extent, but my ideas came back in the shape of a wall.

This really frustrated me, because the ideas I had were not going to work with my programming. My only choice was to go back, rethink, and edit my lines of code.

Scraping The Wrong Website!

Once I got everything together and working through the test, it was time for me to scrape from website using Nokogiri. Oh, man, did I scrape from the wrong websites! The first website I tried scraping from was cars.com, this site had a lot of scripts, so it would not allow any scraping. Time to find another, next I tried bluebook.com, this website would allow me to scrape some info from it. Ok, I thought it’s was going to work, NOPE!! There were other materials I wanted to grab, but the website wouldn’t allow it. My thoughts were “FINE I WILL JUST SEARCH FOR A BETTER ONE” I was getting annoyed. I was starting to believe that choosing another topic for the project would be a better option. Craigslist was my next scraping site, same problem as bluebook. Now it felt like I was scratching lottery tickets and these were the results.

Don’t give up keep going!

At this point I was losing hope with the topic I chose for this project. I did not want to redesign my project by choosing another topic to program about, so I kept searching unit I find the golden ticket, in this case, it was “enterprise.com”. Finally, the website I have been looking for is in the palm of my hands. Everything I needed to scrape for this project was allowed. All I had to do was set the codes and it was a home run I thought. Nope, the controller to the tv wasn’t working properly. There was some wiring that was off, in this case, it was the looping. This issue was not much of a problem, but I’ve gotten through so many situations I need a break or I was going to quit. Luckily, I found some help that has been pushing me through thick and thin. I was told that my looping was not really making sense and I should think of it in real life. BAM the solution came to my head, I programmed it and the controller began to work correctly.

What I’ve Learned!

This project was a big learning curve for me, not alone I learned the lessons don’t think too far ahead, take things one step at a time, and don’t give up. There were also codes I did not understand fully. The instance variables and class variables were the two that really helped the most after I understood them; instance variables are a scope that is confined to whatever object self refers to. Outside the scope instance, variables can’t be changed, so they are private to other classes. Class variables have the same values in all class instances and they are also private. The only way to get these variables outside the scope is to have a setter/getter method and ruby provides shortcuts called attr_accessor, attr_writer, and attr_reader. By understanding these concepts, I was able to work faster and make more sense of the situations I was in and fix them more efficiently.

--

--