Sha256: d7253a7ebc54b164d1e542f45a23b9383cdf2c1d56b01be9915f50d120dc3971

Contents?: true

Size: 1020 Bytes

Versions: 1

Compression:

Stored size: 1020 Bytes

Contents

module AppStorePricingMatrix
  CURRENCY_MAP = {
    :usd => [ :usd, :mxn ], # WARNING: MXN is a valid Mexican peso - there's no MXP, apparently.
    :cad => [ :cad ],
    :aud => [ :aud, :nzd ],
    :jpy => [ :jpy ],
    :eur => [ :eur, :dkk, :nok, :sek, :chf ],
    :gbp => [ :gbp ]
  }
  CUSTOMER_CURRENCIES = CURRENCY_MAP.values.flatten.map{|i| i.to_s.upcase }
  DEVELOPER_CURRENCIES = CURRENCY_MAP.keys.map{|i| i.to_s.upcase }

  REVERSE_CURRENCY_MAP = {}.tap do |hash|
    CURRENCY_MAP.keys.each do |key|
      CURRENCY_MAP[key].each do |customer_currency|
        hash[customer_currency.to_s.upcase] = key.to_s.upcase
      end
    end
  end

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

  DEVELOPER_PROCEEDS = {}.tap do |hash|
    DEVELOPER_CURRENCIES.each do |key|
      hash[key] = File.read("#{File.dirname(__FILE__)}/prices/#{key}_pro").split("\n")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
app_store_pricing_matrix-1.0.1 lib/app_store_pricing_matrix.rb