Sha256: 50891246e65b3c498e0e806b427ebbf23a4f1547ae7799be5a32c70e58892d9e

Contents?: true

Size: 505 Bytes

Versions: 3

Compression:

Stored size: 505 Bytes

Contents

begin
  require 'dotenv/load'
rescue LoadError
end

require 'money/bank/open_exchange_rates_bank'

if ENV.key?('OPEN_EXCHANGE_RATE_APP_ID')
  Money.default_bank = Money::Bank::OpenExchangeRatesBank.new.tap do |oxr|
    oxr.cache = File.expand_path('~/.reality/open_exchange_rate.json')
    oxr.app_id = ENV['OPEN_EXCHANGE_RATE_APP_ID']
    oxr.ttl_in_seconds = 86400
    oxr.update_rates # Fetch them from cache or URL...
    oxr.save_rates # And save to cache if fetched. Weird API, seriously.
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
reality-0.1.0.alpha3 lib/reality/setup.rb
reality-0.1.0.alpha2 lib/reality/setup.rb
reality-0.1.0.alpha lib/reality/setup.rb