Sha256: 28b0c2026b9e776d4e9b8461cef94464e9b1afcdecca36a27fd154f5de6454c1
Contents?: true
Size: 734 Bytes
Versions: 1
Compression:
Stored size: 734 Bytes
Contents
require 'money' require 'money/bank/open_exchange_rates_bank' module Ec2spec module Calculator module ApiPriceCalculator OXR_CACHE = 'oxr.json' def currency_unit @currency_unit end def currency_unit_price(dollar_price) Money.new(dollar_price * 100, :USD).exchange_to(currency_unit) end def cache_file File.join(Ec2spec.project_dir, OXR_CACHE) end def prepare_exchange_api(app_id) prepare_money(app_id) end def prepare_money(app_id) oxr = Money::Bank::OpenExchangeRatesBank.new oxr.app_id = app_id oxr.cache = cache_file oxr.update_rates Money.default_bank = oxr end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ec2spec-0.1.3 | lib/ec2spec/calculator/api_price_calculator.rb |