My First CLI Project: Cocktail recipes for cocktails starting with the letter ‘A’

Completion of my 1st CLI project with an API

This project has had a lots of ups and downs in just a few days. I first wanted to create a project by scraping a website introducing the world’s best bars. I thought it was going to be fun and exciting. The excitement went away when I realized that it was much more complicated that it sounds. After spending an entire day, about 12 hours working on the project, I realized that I should work with an API which makes things easier. I had already set up my first project so setting up the second one went really smooth. And after a couple days of hard work I managed to finish my project. What a great feeling!

Let me tell you what I wish I would have known before I started the project:

  1. How to find APIs (Application Programming Interface):

If I could turn back time, I would do a much better job with my initial planning. A good way to start is by browsing this list list of Public APIs on @jbrooksuk’s GitHub: https://github.com/public-apis/public-apis

Alternate sites for APIs:

2. Take some time before the beginning of the project to go through all the APIs and look an API that does not require an api key , when you are looking under the Auth column, choose APIs with ‘No’ listed by it and is able to produce the data that you’d like to display to your user.

3. Stop everything that you are doing and focus on the project. Also take some breaks as often as possible as you might become less focus after a few hours. Go on a walk, do some cooking, watch a little bit of TV and go back to your project. And know when to stop at night, you are not as effective after a certain amount of hours.

4. Set up your project. Take some time to fully understand how the project is going to work. Watch a few videos that explain your project from A to Z. Some videos are just going to cover one part so make sure you watch a good sample before you jump on your project. You need to install your gem by typing:

a) bundle gem cocktail_list (notice the underscore, it has to be this way so it only create one file instead of some subfiles)

b) cd cocktail_list (to access your directory)

c) code . (to open your coding app)

d) You are now in your app and ready to start your program.

5. Make sure you take some time to install all the gems necessary to run your program. There is a wide variety depending if you scrape a website or if you use an API. I used:

a) Pry (which allows you to debug your program)

b) JSON (JavaScript Object Notation (JSON) is a standard text-based format for representing structured data based on JavaScript object syntax. It is commonly used for transmitting data in web applications)

c) Rest-client (REST Client is a method or a tool to invoke a REST service API that is exposed for communication by any system or service provider.)

ND: You also need to update your gemspec file, by filling the “TODO” that are required (summary, description and url)and add some dependencies.

6. Once all your gems are installed, you need to create your files and link them to one another by using the “require_relative” accordingly. Note that we use “require” when use a gem outside of your program like Pry or JSON, as opposed to “require_relative” when you want to link two of your files. I created:

a) Api.rb, which is where I dealt with the data

b) Cli.rb which is how you are going to interact with the customer

c) cocktail.rb which is where I create my class Cocktail.

And the rest is programming…

Overall, it has been a very interesting project, I definitely learnt a lot, and with the help of our cohort leader (Enoch) and other cohort mates, I managed to finish my project on time.

French guy who recently moved to the United States. I am also changing career after having worked 13 years in restaurants. I will be going into coding.