Sha256: 8d75c273dd35fab383eee996127e7eb3808a078565317fca931d7cc4e8edec95

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 Bytes

Contents

module AppStorePricingMatrix
  CURRENCIES = %w(USD CAD MXN AUD NZD JPY EUR DKK SEK CHF NOK GBP CNY SGD HKD TWD RUB TRY INR IDR ILS ZAR SAR AED).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.1.0 lib/app_store_pricing_matrix.rb