I have found this add-on for updated Mani Mani from ECB European Central Bank (updated every 24 hours)
eu_bank || = EuCentralBank.new eu_bank.update_rates #Rails Cache.fetch ('rates',: expires_in = & gt; 24.hours) {eu_bank.update_rates} rate = eu_bank.exchange_with (money.nav (100, session [: currency]) , "USD"). To_f
In some files there is a function to write rates ... but I'm not sure I want what I want. I am also using halokak which has a read only file system.
eu_bank.save_rates ("/ some / file / location / exchange_rates.xml")
I could not find any way to check the age of the object either I am thinking of the best option to load it once in 24 hours and continue for my entire rail application. Any sign?
This rail can be done using low-level caching and first_filters:
< Previous>This code will download rates once in 24 hours and save the result in the cache (caching module that you use), From where the Bank Object loads them on every request.
Comments
Post a Comment