Intermediate Projects
Prerequisites: Level 2 — Intermediate
Build these using classes, modules, exceptions, files, gems, JSON, HTTP,
and tests from Level 2. Give each project its own folder with a Gemfile
and at least a few Minitest or RSpec tests.
1. Expense Tracker
Model an Expense class (amount, category, date) and an ExpenseBook
that includes Enumerable. Save and load expenses from a JSON file, and
print a monthly report grouped by category with group_by and sum.
Raise a custom InvalidExpense error for negative amounts.
2. Weather Command-Line App
Call a free weather API with Net::HTTP, parse the JSON response, and
print the current temperature for a city passed as a command-line
argument (ARGV.first). Read the API key from an environment variable
with ENV.fetch, and handle network errors and non-200 responses
gracefully.
3. File Organizer
Walk a folder with Dir.glob("**/*"), and move files into subfolders by
extension (images/, documents/, other/) using FileUtils.mv. Add a
--dry-run option that only prints what would happen, and log every move
with Logger.
4. Contact Book Library
Package a ContactBook class as a small gem-shaped library (lib/,
test/, a .gemspec), with search by name and email validation using a
regular expression. Cover it with tests and run RuboCop until it's clean.