Я работаю в конвертере валют Google, но он не работает.Он просто перенаправляет на:
http://finance.google.com:80/bctzjpnsun/converter?a=1&from=EUR&to=USD
или выдает ошибку 404 Not Found
Это мой код:
gem file:
gem 'money'
gem 'google_currency', '~> 3.4.1'
метод конвертации
def self.exchange_to_USD annual_salary, currency
begin
mothly_salary = annual_salary / 12
if currency.present?
salary = Money.new(mothly_salary, currency).exchange_to(:USD).fractional
else
salary = mothly_salary
end
rescue Money::Bank::UnknownRate => e
salary = mothly_salary
rescue Exception => e
salary = mothly_salary
end
salary
end
файл application.rb
require 'money'
require 'money/bank/google_currency'
# set the seconds after than the current rates are automatically expired
# by default, they never expire
Money::Bank::GoogleCurrency.ttl_in_seconds = 86400
# set default bank to instance of GoogleCurrency
Money.default_bank = Money::Bank::GoogleCurrency.new