lib/money/bank/currencylayer.rb
##
# Takes the response from jsonrates.com and extract the rate.
#
# @param [String] data HTTP-Response of api.
#
# @return [BigDecimal]
Takes the response from jsonrates.com and extract the rate.
Takes the response from jsonrates . com and extract the rate .
def extract_rate(data, from, to)
        request_hash = JSON.parse(data)
        success = request_hash['success']
        raise RequestError, request_hash['error']['info'] unless success
        BigDecimal.new(request_hash['quotes']["#{from}#{to}"].to_s)
      end
def extract_rate ( data , from , to ) request_hash = JSON . parse ( data ) success = request_hash [ 'success' ] raise RequestError , request_hash [ 'error' ] [ 'info' ] unless success BigDecimal . new ( request_hash [ 'quotes' ] [ "#{from}#{to}" ] . to_s ) end
Takes the response from jsonrates.com and extract the rate.
Takes the response from jsonrates . com and extract the rate .
None
BigDecimal
data
<not_specific>
from
<not_specific>
to
<not_specific>
<not_specific>
data HTTP-Response of api.
data HTTP - Response of api .