class RailsCurrency::Convertor::Google
Constants
- CURRENCIES
Public Class Methods
convert(amount, from, to)
click to toggle source
# File lib/rails_currency/conversion_services/google.rb, line 181 def convert(amount, from, to) Convertor.convert(amount, from, to, 'google') end
get_rate(from, to)
click to toggle source
# File lib/rails_currency/conversion_services/google.rb, line 191 def get_rate(from, to) convert(1, from, to) end
process_request(amount, from, to)
click to toggle source
# File lib/rails_currency/conversion_services/google.rb, line 185 def process_request(amount, from, to) url = "#{service_url}?a=#{amount}&from=#{from}&to=#{to}" doc = open(url, Convertor::PARAMS) { |f| Hpricot(f) } result = doc.search("//span[@class='bld']").inner_html.split(' ').first.to_f end
service_url()
click to toggle source
# File lib/rails_currency/conversion_services/google.rb, line 177 def service_url 'http://www.google.com/finance/converter' end