Sha256: eab23fa9c2943d8429e9eaae0448ec288630f9950b45b38ecc7ea04d6ba10cb9

Contents?: true

Size: 807 Bytes

Versions: 1

Compression:

Stored size: 807 Bytes

Contents

module AppStorePricingMatrix
  CURRENCIES = %w(USD CAD MXN AUD NZD JPY EUR DKK SEK CHF NOK GBP CNY SGD HKD TWD).freeze
  EURO_CURRENCIES = %w(BGN CZK EEK HUF LVL LTL MTL PLN RON).freeze

  CUSTOMER_PRICES = {}.tap do |hash|
    CURRENCIES.each do |currency|
      hash[currency] = File.read("#{File.dirname(__FILE__)}/prices/#{currency.downcase}").split("\n").freeze
    end
  end.freeze

  DEVELOPER_PROCEEDS = {}.tap do |hash|
    CURRENCIES.each do |currency|
      hash[currency] = File.read("#{File.dirname(__FILE__)}/prices/#{currency.downcase}_pro").split("\n").freeze
    end
  end.freeze
  
  def self.customer_currency_for(currency_code)
    code = currency_code.to_s.upcase
    return code   if CURRENCIES.include? code
    return 'EUR'  if EURO_CURRENCIES.include? code
    return nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
app_store_pricing_matrix-2.0.0 lib/app_store_pricing_matrix.rb