CLI Data Gem Portfolio Project

Zainab Omar
2 min readAug 27, 2020

--

I am finally done with my first project at Flatiron School. It was very challenging for me to get my code work in the way I wanted to. It was hard to work without having spec files as I used to when I am doing my labs. After spending three days searching for APIs and try to understand their documentation and three days struggling on how to use ‘Pry’ I am finally got my code to work. I decided to use API to get the data for my project. I search for many APIs but I had difficulty understanding their documentations Until I ran into https://rapidapi.com/ and found the Api I want to get my data from.

I used http://www.recipepuppy.com/ API. My project is about getting a list of recipes based on users inserted ingredients. To do that, I get my data from recipe puppy as a Json hash, parse it and start making objects from them. It took me a while, until I got my api class working. My issues were not writing the codes but were on how I test my output and make sure I am getting what I want before I move on to the next step. I took me about three days until I understood how to use “Pry” correctly. After understanding using Pry, the rest of the codes went smoothly.

I started my project on writing api class, parse data and use them to create objects through my recipes class that is responsible for that. My recipes class has (initialize) method that use meta programming to add or remove attributes in case the owner of the site I got my data from changed something in it. After that I created a constant @@all to save my instances. I also create class method called (all) to save my instances in it.

I wanted my CLI class to be simple. I make the user inputs limited to lowercase letters. If user input was not comma separated will get error, so I used (gsub method) to replace spaces with commas. To start my CLI project, I created (call method) in my CLI class that will be called inside my bin file. After (call method) called it shows a greeting message and then run my (list method) that has other method called inside it. List method will ask users to insert their ingredients, show list of matching recipes, ask users again to pick the recipe they are interested in, show details, ask if users want to see another recipe, if answer no it show goodbye message and exits the program.

I learned so much about coding in the first mod. Just weeks ago, I had never coded before. I am very excited to do my assessment and start mod2. Thank you for reading my second blog, have a good day!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response