
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Ruby gem for currency conversion based on Open Exchange Rates API - free / open source hourly-updated currency data for everybody
Please see https://github.com/josscrowcroft/open-exchange-rates#accuracy
Add this line to your application's Gemfile:
gem 'open_exchange_rates'
And then execute:
$ bundle
Or install it yourself as:
$ gem install open_exchange_rates
You will need App ID to use OpenExchangeRates, you can get one here for free.
Option 1
Set OPEN_EXCHANGE_RATES_APP_ID environment variable and it will be used automatically. If you are using foreman for example just add it to your .env file like this
OPEN_EXCHANGE_RATES_APP_ID=YourAppID
Option 2
OpenExchangeRates.configure do |config|
config.app_id = "YourAppID"
end
If you are using Rails good place to add this is config/initializers/open_exchange_rates.rb
Option 3
Pass it on initialization
fx = OpenExchangeRates::Rates.new(:app_id => "YourAppID")
Start by creating OpenExchangeRates::Rates instance
fx = OpenExchangeRates::Rates.new
Convert between currencies using current rates
fx.convert(123.45, :from => "USD", :to => "EUR") # => 99.87
Convert between currencies on specific date
fx.convert(123.45, :from => "USD", :to => "EUR", :on => "2012-05-10") # => 95.47
Get current exchange rate
fx.exchange_rate(:from => "USD", :to => "EUR") # => 0.808996
Get exchange rate on specific date
fx.exchange_rate(:from => "USD", :to => "EUR", :on => "2012-05-10") # => 0.773329
If you omit :from or :to option conversion will be related to base currency. USD is set as base currency (plan is to add this as config option in the near future).
fx.convert(123.45, :to => "EUR") # => 99.87 EUR
fx.convert(123.45, :from => "EUR") # => 152.51 USD
fx.exchange_rate(:to => "EUR") # => 0.808996
fx.exchange_rate(:from => "EUR") # => 1.235414
git checkout -b my-new-feature
)git commit -am 'Added some feature'
)git push origin my-new-feature
)cp env.example .env
.env
and enter your API IDrake
This project rocks and uses MIT-LICENSE.
Please check Open Exchange Rates API license and terms also.
FAQs
Unknown package
We found that open_exchange_rates demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.