This script obtains and calculates foreign exchange rates using a given JSON or CSV file.
Ensure you have installed Ruby, Rubygems (a package manager framework for Ruby) and Bundler (a Ruby gem management gem).
-
Fork this repo (for instructions, see here)
-
Navigate to the repo directory in your terminal (check out these links for mac, windows or linux for instructions)
-
Install gems:
bundle install
-
Run tests:
bundle exec ruby test/run_tests.rb
-
Start a console session (if it's your first time, see this helpful tutorial):
bundle exec irb -Ilib
-
Load the template library:
require './lib/currency_exchange'
-
Calculate an exchange rate:
CurrencyExchange.rate(date: Date.new(2018,11,22), from: "GBP", to: "USD", file: 'data/eurofxref-hist-90d.json')
If you run into any problems in the setup or installation of this programme, please raise an issue or if you're not familiar with GitHub, please feel free to reach out on Twitter.
Remember, as the late great Jim Weirich noted, mountains are merely mountains, so don't worry if you get stuck - we are here to help ❤️
We have implemented three exception cases. If a currency, date or file requested is not found, an error is generated.