I was off to a rough start building out the Planet Program that knows different minerals and plants on our planet. I had the concept down and understood how to get started, but then somehow me and/or the computer got lost in translation. I knew I wanted to work with the Plant API hosted by Trefle.io, but it was my first time dealing with an API on my own. I knew what I was generally doing but it just wasn’t working for me. The first of my issues was I didn’t realize I needed a token, which I eventually got and learn how to view the data in my browser. So now it was time to code, right? Trefle provides sample code to use but when I would use pry to see my data, it wasn’t the showing up and I kept getting errors. I suddenly remembered that there’s different languages and I wasn’t using the ruby code for the API, which required “httparty”… I put everything together and was able to view the data with my code.

With my vision and data clear, I was able to move on to the logic of my program and start working on its interactivity and user experience.

I wanted to welcome said user to the experience, while in the background I’m using the plant API to get all my plants. After being welcomed, I wanted to them to express whether they wanted to learn more about plants or minerals. My program would be able to provide a detailed description of plants, such as their common name, family, genus, and a link to an image because of the API. The data was provided neatly inside of a hash as the value of a “data” key while being an array, so I was able to iterate over the array and get the value of each key, which is exactly what I needed. However, I didn’t want my program to know nothing about minerals, because what’s a planet without minerals? Exactly… It didn’t need to know all the details of every mineral but at least their names, which lead to my scraping journey.

I ran into another road block when I started trying to scrap the names of minerals from a website. I tried various websites and various methods, requiring all kinds of gems, just to at least get the request sent to the websites. The same bug just kept popping up no matter what I did! I eventually had to ask someone if, because I was slowly coming to the conclusion, some websites just can’t be scraped. It’s true but I’m certain they are some people who can scape any website, but I’m not there yet. I eventually found a website that worked perfectly. The data was in a big string but I was able to convert into an array to mine all the mineral names from the website.

Outta mines and back to the code! The user can use numbers through out the experience to select any of the given options, starting with the first. Selecting 1 shows you the first 20 plants in the plant API dataset and 2 shows you all the minerals on our planet. While you can only learn the mineral names, you can learn more about any of the plants after selecting 1 by selecting the number next to the plant. At any point throughout the app, the user can type leaf to leave the program. I wanted them to feel like they were taking a leaf with them and typing it was the next best thing.

I used a lot metaphors to help with my understanding of what I was doing to create the program and to process code implementation. For example, my classes that get the data from the API and website for the plants and minerals are called planting and mine respectively. My plant class with all my plant objects is initialized with “seeds” which are the result of my planting. My method that details the information about the different plants is called botanist. Their names describe what they’re doing in the background for the planet program.

While it started out rough, the overall journey was great and I feel like my program has a lot of potential. I could build it out to include animals, which is kind of hinted at when you “leaf” it. I enjoyed making it and hope that any future user enjoys the experience. It’s not a grand one, but it is an experience.

New Orleans native and Universal man still learning, still growing.