module Ec2spec::Calculator::ApiPriceCalculator

Constants

OXR_CACHE

Public Instance Methods

cache_file() click to toggle source
# File lib/ec2spec/calculator/api_price_calculator.rb, line 17
def cache_file
  File.join(Ec2spec.project_dir, OXR_CACHE)
end
currency_unit() click to toggle source
# File lib/ec2spec/calculator/api_price_calculator.rb, line 9
def currency_unit
  @currency_unit
end
currency_unit_price(dollar_price) click to toggle source
# File lib/ec2spec/calculator/api_price_calculator.rb, line 13
def currency_unit_price(dollar_price)
  Money.new(dollar_price * 100, :USD).exchange_to(currency_unit)
end
prepare_exchange_api(app_id) click to toggle source
# File lib/ec2spec/calculator/api_price_calculator.rb, line 21
def prepare_exchange_api(app_id)
  prepare_money(app_id)
end
prepare_money(app_id) click to toggle source
# File lib/ec2spec/calculator/api_price_calculator.rb, line 25
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