What I have learned and more
It’s been a hectic and difficult couple of weeks learning how to code in Ruby and trying to keep everything else functioning in real life. So many times I wanted to give up. This may sounds cliche but we do have to take everything slowly, one ‘bug’ at a time.
To be honest, I’ve dreaded our first project week with Flatiron School. Where and how do I start? Do I actually have a clear understanding of what Ruby Object Oriented program is and am I capable to create an app with everything we’ve been taught at school so far? And so.. I took a deep breath, told myself to take this one step at a time, and stay optimistic!
For my first project, I started listing topics I am interested in, and listed some things I have trouble with. As a wife and mom, meal planning and grocery shopping have been on the top of my to-do list. So, a Meal Plan CLI application would be perfect for this project.
I expected this app to give the user ability to customize a meal plan according to their diet, intolerance, and caloric target for the day. The end goal is for the user to choose a recipe based on their preferences and add the ingredients to a shopping list.
I have scoured the internet for inspirations and have searched for similar projects for guidance.
#1 tip for my fellow students at any bootcamp is to immerse yourself and read all the materials provided by your cohort. I got overwhelmed in the beginning and went to google for answers and project ideas when I could have save time by saturating the existing resources given to us.
#2 tip — make “Pry” your best friend. I heard this phrase many times over and that I exactly did or tried doing! I’ve often use ‘pry’ when doing lab works to get more in-tuned to it. This gem will help you look into your code and see the inside of it. Debugging with ‘pry’ had helped me better understand how my code works and identify issues within my code.
For this project, I decided to use the Spoonacular API. I found their documentation pretty straightforward and easy to use. I do have to keep my Spoonacular API key hidden by using environment variables so that nobody can use and exploit it. If you want to know more about how to hide your API keys in Rails and React, check out this article https://medium.com/@muesingb/a-simple-guide-to-hiding-api-keys-in-rails-and-react-using-environment-variables-abc6199f487e.
Starting the app, the user will be presented lists of diets and intolerances which I have scraped from the Spoonacular API website. Based on the user’s selection, the app will pull out data from the API and information like the recipes, instructions and ingredients will get displayed for further action.
My biggest problem was how to pull the data from the API with the user’s selection of diets and intolerances as parameters. First, I have to store the user’s input as a hash. Then use the hash as an argument to make an API request.
On the API class, I have to transform our hash following the Spoontacular API format so it can finally retrieve the customized daily meal plan according to our user’s input.
In conclusion, doing this project taught me to really persevere with coding, to commit in the process, keep building and cultivating the skill nobody is ever born with. And certainly, anybody can be better at it with regular practice.
Thank you for reading!