mirror of
https://github.com/hakanensari/frankfurter.git
synced 2024-11-22 11:02:30 +01:00
19 lines
331 B
Ruby
19 lines
331 B
Ruby
require 'currency'
|
|
require 'fixer'
|
|
|
|
namespace :rates do
|
|
desc 'Reload all rates'
|
|
task :reload do
|
|
Currency.delete
|
|
data = Fixer::Feed.new(:historical)
|
|
Currency.multi_insert(data.to_a)
|
|
end
|
|
|
|
desc 'Update rates'
|
|
task :update do
|
|
Fixer::Feed.new.each do |hsh|
|
|
Currency.find_or_create(hsh)
|
|
end
|
|
end
|
|
end
|