Rails that works?

It is just interesting if someone used a ruby โ€‹โ€‹currency exchange bank that receives exchange rates from an external api and actually works. I tried the following stones, but could not make them function as described:

goog_currency, yahoo_currency, google_currency, yahoo_finance_currency

One of these methods uses outdated code and, therefore, does not work correctly.

I'm just trying to display the exchange rate in the form of rails that was captured from an external api.

I also considered trying to parse json from yahoo / google finance urls, but this seems a lot more complicated than necessary.

+4
source share
1 answer

I selected google_currency from your list as the most popular and it was recently saved. It worked for me, I ran the code from the resume without any problems.

If you saw the message:

 You are using an old or stdlib version of json gem Please upgrade to the recent version by adding this to your Gemfile: gem 'json', '~> 1.7.7' 

You may then need to update the copy of multi_json to avoid json abandonment warnings:

 gem install json gem install multi_json 

Which should (at the time of writing) install json 1.8.0 and multi_json 1.7.8. Or, of course, if this is for a project, you should be able to select these versions in your Gemfile if there is no conflict with other libraries in your project. A message may call you, but this is not a problem with google_currency .

I did not notice conflicts or problems with the google_currency stone using legacy JSON modules or the latest ones. To do something similar to what you want:

 require 'money' require 'money/bank/google_currency' bank = Money::Bank::GoogleCurrency.new bank.get_rate(:GBP, :USD).to_f => 1.5513 
+6
source

Source: https://habr.com/ru/post/1496317/


All Articles