CLI project — beauty products shopping simulation
After 3 weeks at Flatiron, I was instructed to created a project concerning Object-Orientation Relationship. I found an API make up site that allows users can look up various products and which gave me the idea to develop a shopping simulation program for beauty products. I have always enjoyed shopping and beauty products myself and figured this would suit my personality. I fetched API data from the site and changed its format to JSON. I’ve learned that “Gems” are super helpful.
What’s a Gem?
According to rubygems, “The RubyGems software allows you to easily download, install, and use ruby software packages on your system. The software package is called a gem which contains a packaged Ruby application or library. Gems can be used to extend or modify functionality in Ruby applications. Commonly they’re used to distribute reusable functionality that is shared with other Rubyists for use in their applications and libraries. Some gems provide command line utilities to help automate tasks and speed up your work.” In my opinion, gems are built in code or extensions that you don’t have to write and help you save time.
For example, I was trying to make my project more lively and fit the context of beauty products, so I decided to make it more colorful and feminine. How can I write a colorful code? ….. what about gems? then I searched on google and found lolize. Wow! Look at that gem! Let me show you how it works.
- Here is my project without ‘Lolize’ — it’s boring, right?
- Here is the colorful app, when I install ‘ gem Lolize’ in my project
How to use lolize
First, you have to install a gem by typing the below code in your terminal
gem install lolize
type the snippet in your environment file
gem 'lolize'
require 'lolize/auto'
Now let me share some other useful gems and codes I used for my project.
Gems and useful codes
- gem pry — for debugging
- gem json — parse a JSON document into a ruby data structure
- gem bundler — provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed
- gem lolize — rainbow colors
- system “clear” || system “cls” — use one of these codes to clear the terminal screen
- sleep() — tells ruby to delay display
- Kernel.exit — closes the terminal app
Resource and reference list: