README.md in danconia-0.2.9 vs README.md in danconia-0.3.0

- old
+ new

@@ -1,11 +1,21 @@ # Danconia -A very simple money library for Ruby, backed by BigDecimal (no conversion to cents, i.e. "infinite precision") with support for external exchange rates services. +A very simple money library for Ruby, backed by BigDecimal, with multi-currency support. [![Build Status](https://travis-ci.org/eeng/danconia.svg?branch=master)](https://travis-ci.org/eeng/danconia) +## Features + +* Backed by BigDecimal (no conversion to cents is done, i.e. "infinite precision") +* Multi-currency support +* Pluggable exchange rates services: + - [CurrencyLayer API](https://currencylayer.com/) + - [BNA](https://www.bna.com.ar/) + - FixedRates (for testing use) +* Pluggable stores for persisting the exchange rates + ## Installation ```ruby gem 'danconia' ``` @@ -27,14 +37,16 @@ Please refer to `examples/single_currency.rb` for some configuration options. ## Multi-Currency Support -To handle multiple currencies you need to configure an `Exchange` in order to fetch the rates. For example, with [CurrencyLayer](https://currencylayer.com/): +To handle multiple currencies you need to configure an `Exchange` in order to fetch the rates. For example, with CurrencyLayer: ```ruby # This can be placed in a Rails initializer +require 'danconia/exchanges/currency_layer' + Danconia.configure do |config| config.default_exchange = Danconia::Exchanges::CurrencyLayer.new(access_key: '...') end ``` @@ -54,9 +66,11 @@ ## Active Record Integration Given a `products` table with a decimal column `price` and a string column `price_currency` (optional), then you can use the `money` class method to automatically convert it to Money: ```ruby +require 'danconia/integrations/active_record' + class Product < ActiveRecord::Base money :price end Product.new(price: 30, price_currency: 'ARS').price # => 30 ARS