This gem is a wrapper of a simple scrapper to make it easy to check the currency quote. It's possible to use it in a project or the CLI option.
Due the nature of this gem, it's provided as-is, without any warranties or guarantees of any kind. The author(s) of this gem are not responsible for any consequences, including but not limited to, damages, errors, or misuse resulting from the use of this gem.
Users of this gem are expected to understand its functionality and use it responsibly.
By using this gem, you acknowledge and accept that the author(s) shall not be held liable for any issues or damages arising from its use.
It's not recommended using the gem on a production environment since it depends on third-parties. Additionally the gem was purely developed as a hobby project.
gem 'currency_scrapper', git: 'https://github.com/lucasmenezesds/currency_scrapper'
Since the gem is not published you'll need to clone the repository.
After cloning the repository, navigate to inside the folder and run
$ gem build currency_scrapper.gemspec
$ gem install currency_scrapper-0.3.3.gem
# OR
$ gem install currency_scrapper-X.X.X.gem
Where X.X.X
is the version of the gem generated after you run the build command.
NOTE: Please make sure you're using the correct initials(ticker) for the currency you would like to check it's values.
NOTE 2: This gem just gets the values from the website in question, if the currency values are wrong, please check the website before opening a PR.
For Google Finance
require 'currency_scrapper'
usd_jpy = CurrencyScrapper::GoogleFinance.quote_currency('USD', 'JPY')
puts usd_jpy
# => { :sell_value=>146.1795, :base_currency=>"USD", :target_currency=>"JPY", :timestamp=>"Sep 3, 10:38:56 PM UTC" }
# OR
CurrencyScrapper::GoogleFinance.quote('USD', 'JPY')
For Investing Dot Com
require 'currency_scrapper'
usd_jpy = CurrencyScrapper::InvestingDotCom.quote_currency('USD', 'JPY')
puts usd_jpy
# => {:sell_value=>149.3, :base_currency=>"usd", :target_currency=>"jpy", :timestamp=>"Oct 6, 8:59:53 PM UTC", :buy_value=>149.29, :previous_close_value=>148.5, :days_range=>"148.37 - 149.54"
# OR
CurrencyScrapper::InvestingDotCom.quote('USD', 'JPY')
$ currency_scrapper usd-jpy
# OR
$ currency_scrapper usd-jpy -gf
You can also add a value to be converted, for example:
$ currency_scrapper usd-jpy 500
# OR
$ currency_scrapper usd-jpy -gf 500
$ currency_scrapper usd-jpy -idc
# Or with a value to be converted
$ currency_scrapper usd-jpy -idc 500
Some examples of currency tickers are:
USD - United States Dollar
EUR - Euro
GBP - British Pound Sterling
BRL - Brazilian Real
JPY - Japanese Yen
AUD - Australian Dollar
CAD - Canadian Dollar
CHF - Swiss Franc
CNY - Chinese Yuan
INR - Indian Rupee
SGD - Singapore Dollar
MXN - Mexican Peso
NZD - New Zealand Dollar
ZAR - South African Rand
AED - United Arab Emirates Dirham
HKD - Hong Kong Dollar
SEK - Swedish Krona
NOK - Norwegian Krone
DKK - Danish Krone
KRW - South Korean Won
Bug reports and pull requests are welcome on GitHub at https://github.com/lucasmenezesds/currency_scrapper. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
Unit Tests
bundle exec rspec
End-to-End Tests
bundle exec rspec --tag e2e:true
The gem is available as open sour ce under the terms of the MIT License.
Everyone interacting in the CurrencyScrapper project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.