Skip to content

Instantly share code, notes, and snippets.

@kakawka
Created September 1, 2014 08:11
Show Gist options
  • Save kakawka/a30b61d43533fe4e3d6e to your computer and use it in GitHub Desktop.
Save kakawka/a30b61d43533fe4e3d6e to your computer and use it in GitHub Desktop.
require "./lib/exchange_rates"
rates = ExchangeRates.new
data = {czk: rates.get_value_by_char_code('CZK'), usd: rates.get_value_by_char_code('USD'), eur: rates.get_value_by_char_code('EUR')} if rates.ok?
every 3.hours do
runner "Exchange.find_by_name('CZK').update_attribute(:rate, data[:czk])"
runner "Exchange.find_by_name('USD').update_attribute(:rate, data[:usd])"
runner "Exchange.find_by_name('RUB').update_attribute(:rate, data[:eur])"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment