Ruby Gem for Currency Conversion with Caching
Build a small reusable Ruby gem that fetches exchange rates from a public API, converts amounts between currencies, and caches rates locally to reduce API calls. Learners practice gem structure, HTTP requests, simple file-based caching, and writing a clean public API for a library.
- Estimate
- ~7h
- Steps
- 5
- Completed by
- 0
- Proposed by
- codeseed.app
Faraday
Project roadmap
- 01
Scaffold the gem structure
~1hUse bundle gem to create the gem skeleton with a lib folder and a CurrencyConverter class.
- 02
Implement the API client
~1.5hUse Faraday to fetch current exchange rates from a public currency API and parse the JSON response.
- 03
Add local caching
~1.5hCache fetched rates to a local file with a timestamp, reusing cached rates if they're less than an hour old.
- 04
Implement the conversion method
~1hAdd a convert(amount, from, to) method that uses cached or freshly fetched rates.
- 05
Write specs and usage docs
~2hWrite RSpec tests with stubbed HTTP responses and document gem usage in the README.
Resources
Ready to build this?
Get a GitHub repo and start building. Your AI reviewer checks each step as you go.
Tech stack