module BitcoinValue

Constants

API_URL
VALID_FIATS
VERSION

Public Class Methods

method_missing(meth, *args, &block) click to toggle source
# File lib/bitcoin_value.rb, line 15
def method_missing(meth, *args, &block)
  currency = meth.upcase.to_sym
  raise ArgumentError, "Cannot fetch data for #{currency}, as it is not offered by the API!" if !VALID_FIATS.include?(currency)
  JSON.parse(Mechanize.new.get("#{API_URL}/#{currency}").body)['24h_avg']
end