![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Arbolito is a minimalist Ruby API for currency conversions, it has no dependencies except the Ruby Standard Library.
It's like your Florida street best companion!
BigDecimal
class and Hash
There were two reason why I've developed this gem.
First the argetine economy makes difficult to keep the prices updated with official exchanges rates like Yahoo Finance, so we had to manage our own prices rates. But also I wanted to know the rates of other currencies through Yahoo Finance. This gem lets you do both.
The second reason is that other gems implements their own money or currency model, and I didn't want to update all my models to manage those objects. That's why I tried to be agnostic on how you implement your currencies.
The API just receives a Big Decimal and a hash describing the conversion
Add this line to your application's Gemfile:
gem 'arbolito'
And then execute:
$ bundle
Or install it yourself as:
$ gem install arbolito
require 'arbolito'
# We can add multiple rates
Arbolito.add_currency_rate(BigDecimal.new(9), 'USD' => 'ARS')
Arbolito.add_currency_rate(BigDecimal.new(15), 'USD Blue' => 'ARS')
Arbolito.add_currency_rate(BigDecimal.new(12), 'USD Tarjeta' => 'ARS')
Arbolito.add_currency_rate(BigDecimal.new(6.5), 'USD Moreno' => 'ARS')
# It gives the stored rate
Arbolito.current_rate('USD' => 'ARS')
# => #<BigDecimal:7f061f0787e0,'0.15E2',9(27)>
# It stored rate backwards
Arbolito.current_rate('ARS' => 'USD')
# => #<BigDecimal:7f061f076af8,'0.6666666666 6666667E-1',18(36)>
# It can make the conversion for you
Arbolito.convert(BigDecimal.new(100), 'USD' => 'ARS')
# => #<BigDecimal:7f061f1bd010,'0.15E4',9(27)>
Arbolito.convert(BigDecimal.new(100), 'USD Tarjeta' => 'ARS')
=> #<BigDecimal:7f061f39c818,'0.12E4',9(27)>
# Now we ask for the Uruguayan pesos to USD rate
Arbolito.current_rate('UYU' => 'USD')
#<BigDecimal:7f061f142ba8,'0.34E-1',9(18)>
# Now we ask to convert USD to Chilean Pesos
Arbolito.convert(BigDecimal.new(100), 'USD' => 'CLP')
=> #<BigDecimal:7f061f35e680,'0.689695E5',18(36)>
# We can configure Arbolito expiration in seconds
Arbolito.set(:expiration_time, 5 * 60)
# We can implement our own Exchange and configure it in Arbolito
Arbolito.set(:exchange, Exchange::FloridaStreet)
# We can implement our own Store and configure it in Arbolito
Arbolito.set(:store, Store::Mongo)
Yahoo discountinued their Yahoo Finance API so I've implemented another Exchange Alpha Vantage.
To use you need to get an API Key from them and the configure it like this.
api_key = ENV['API_KEY']
Arbolito.set(:exchange, Arbolito::Exchange::AlphaVantage.new(api_key))
Please take a look at the code to see how you can implement your own stores and exchanges.
Bug reports and pull requests are welcome on GitHub at https://github.com/jvillarjeo/arbolito. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that arbolito 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.