hexorx / currencies Goto Github PK
View Code? Open in Web Editor NEWSimple gem for working with currencies. It is extracted from the countries gem and contains all the currency information in the ISO 4217 standard.
License: MIT License
Simple gem for working with currencies. It is extracted from the countries gem and contains all the currency information in the ISO 4217 standard.
License: MIT License
It needs to be
require 'yaml'
for newer rubies. This doesn't fail if you happen to use currencies with another library that requires yaml correctly.
Version 0.4.3 was tagged nearly a year ago. Am I the only one who thinks it’s time to publish that version on rubygems.org now? Would be great if someone could do that! ☺ Thanks.
Thanks to https://github.com/hexorx/currencies/blob/master/lib/currencies/extentions.rb, if Money
is not defined, this defines it as an almost vanilla class, which can lead to unexpected behaviour.
Hi guys,
Noticed you added full_name as an readable attribute. However, the commit was in Dec '14 while the most updated gem is in June '14, so full_name is not accessible with the gem.
Any plans to release an update soon?
I've dug through the code, but I can't figure out why sometimes in my Rails application, a few currencies come out with an exchange rate of 1.0.
In an initializer, I'm setting ISO4217::Currency.base_currency = 'GBP'
Yet somehow:
>> ISO4217::Currency.from_code("EUR") => #<ISO4217::Currency:0xb667a3c @exchange_rate=1.0, @exchange_currency="GBP", @symbol="€", @code="EUR", @name="Euro"> >> ISO4217::Currency.from_code("EUR").load_exchange_rate => 0.8814 >> ISO4217::Currency.from_code("EUR").exchange_rate => 1.0
I understand that load_exchange_rate
doesn't actually store it in @exchange_rate
, I just wanted to show that it's getting it successfully from Yahoo Finance. What I don't understand is how @exchange_rate
got to be 1.0 in the first place. My only call to the Currency class is in a model...
# Value of this currency in the default currency (defined in config/initializers/currencies.rb) def exchange_rate ISO4217::Currency.from_code(iso4217_code).exchange_rate end
Money gem changed the exchange bank implementation. I need to include the bank module and override the exchange_with method.
I discovered the gem was returning 0.0 exchange rates, having checked the source it would seem the yahoo finances request is returning a 403:
http = Net::HTTP.new('download.finance.yahoo.com', 80)
=> #<Net::HTTP download.finance.yahoo.com:80 open=false>
>> response = http.get("/d/quotes.csv?e=.csv&f=sl1d1t1&s=EURGBP=X")
=> #<Net::HTTPForbidden 403 Forbidden readbody=true>
>> response.body
=> "<html><head><title>Yahoo! - 403 Forbidden -- error 403</title></head><body>It has come to our attention that this service is being used in violation of the Yahoo Terms of Service. As such", " the service is being discontinued. For all future markets and equities data research", " please refer to finance.yahoo.com.</body></html>"
@hexorx Hey! Would it be possible to release a new version of the gem with all the updated countries?
Is there any way I could help with that?
For example, JPY typically has 0 decimal places (4200 yen) while USD typically has 2 ($13.99). More information can be found here: https://en.wikipedia.org/wiki/ISO_4217
Hi. First of all, thanks for creating the countries and currencies gems.
I've a question—is the currencies gem still being maintained? There have been no PRs merged since late Feb 2014.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.