module CurrencyWiz

Constants

CURRENCY_CODES
VERSION

Public Instance Methods

exchange_rate(country_code) click to toggle source
# File lib/currency_wiz.rb, line 189
def exchange_rate(country_code)
  response = HTTParty.get("http://openexchangerates.org/api/latest.json?app_id=#{CurrencyWiz::Config::API_KEY}")

  response["rates"].each do |k, v|
    if k == country_code
      return v
    end
  end

  return nil

end
get_code(country) click to toggle source
# File lib/currency_wiz.rb, line 180
def get_code(country)
        CURRENCY_CODES.each do |k, v|
                if v.downcase.include?(country.downcase)
                        return k
                end
        end
        return "Invalid country name"
end