Ruby script for pulling the latest (or historical) currency data from OpenExchangeRates.org
To see a sample use of accessing the open exchange rates api data execute run bot file from the command line
require 'currency_data'
puts 'Instantiating a new CurrencyData object with your app id'
cd = CurrencyData.new('YOUR_APP_ID')
puts 'load the latest currency data and showing...'
cd.load_currency
cd.show
puts 'load historic currency data for September 4th, 2011 and showing...'
cd.load_currency('2011-09-04')
cd.shownote:You must sign up for a free app id at Open Exchange Rates. The free version allows for 1000 requests per month and 1 hour updates on rates. You can pay for more requests and 10 minute updates of rates.
For storing a single instance of a Currency object, including the symbol, name, and value in relation to base currency (USD)
The CurrencyData object interfaces with the OpenExchange object and creates/stores Currency objects that it parses from the api data.
OpenExchange is the wrapper around the Open Exchange Rates api. Pull's the latest currency rates or historical currency rates. Also returns the local currencies.json file for creation of initial @currencies hash.
Sample run of the script
Local version of symbol => name data for all the currencies