app_store_pricing_matrix 1.3.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ pkg
2
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.8.7
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - jruby-18mode
7
+ - jruby-19mode
8
+ - rbx-18mode
9
+ - rbx-19mode
10
+ - ruby-head
11
+ - jruby-head
12
+ - ree
data/Gemfile CHANGED
@@ -1,7 +1,3 @@
1
- source "http://rubygems.org"
1
+ source 'http://rubygems.org'
2
2
 
3
- group :development do
4
- gem "rspec"
5
- gem "bundler"
6
- gem "jeweler"
7
- end
3
+ gemspec
File without changes
data/README.md CHANGED
@@ -10,6 +10,15 @@ Install
10
10
 
11
11
  gem install app_store_pricing_matrix
12
12
 
13
+ Changelog
14
+ ---------
15
+
16
+ v2.0.0
17
+
18
+ * Added SGD, HKD and TWD.
19
+ * `CURRENCY_MAP` and `REVERSE_CURRENCY_MAP` are removed. They are all self-referential now.
20
+ * `CUSTOMER_CURRENCIES` and `DEVELOPER_CURRENCIES` are removed. Use `CURRENCIES` instead.
21
+
13
22
  Usage
14
23
  -----
15
24
 
@@ -24,11 +33,8 @@ That will give you the currency string like `USD` or `EUR`, and this library exp
24
33
  Some constants, useful for validation:
25
34
 
26
35
  ```ruby
27
- AppStorePricingMatrix::CUSTOMER_CURRENCIES
28
- => ["USD", "CAD", "MXN", "AUD", "NZD", "JPY", "EUR", "DKK", "SEK", "CHF", "NOK", "GBP", "CNY"]
29
-
30
- AppStorePricingMatrix::DEVELOPER_CURRENCIES
31
- => ["USD", "CAD", "MXN", "AUD", "NZD", "JPY", "EUR", "CHF", "NOK", "GBP", "CNY"]
36
+ AppStorePricingMatrix::CURRENCIES
37
+ => ["USD", "CAD", "MXN", "AUD", "NZD", "JPY", "EUR", "DKK", "SEK", "CHF", "NOK", "GBP", "CNY", "SGD", "HKD", "TWD"]
32
38
  ```
33
39
 
34
40
  To retrieve a customer price, query with the currency and the tier number:
@@ -48,12 +54,19 @@ AppStorePricingMatrix::DEVELOPER_PROCEEDS['GBP'][30]
48
54
  => "12.78"
49
55
  ```
50
56
 
51
- To retrieve a developer currency from a given customer currency:
57
+ == Updating the price table
52
58
 
53
- ```ruby
54
- AppStorePricingMatrix::REVERSE_CURRENCY_MAP['SEK']
55
- => "EUR"
59
+ The price table was generated by parsing the exhibit C part of the paid app contract PDF file. As of July 18, 2012, it was versioned as v13.
56
60
 
57
- AppStorePricingMatrix::REVERSE_CURRENCY_MAP['DKK']
58
- => "EUR"
59
- ```
61
+ Since the PDF file was malformed, PDF parsing wasn't feasible. My current method to extract out the data semi-automatically is as follows, using Mac OS X 10.7:
62
+
63
+ 1. Select a column vertically using mouse / trackpad from tier 0 through tier 87, including a pair of currency and its commission
64
+ 2. Save it into a text file, naming with the currency - e.g. "usd.txt" under the "input" folder
65
+ 3. Run `rake aspm:generate` to compile the input into pricing data
66
+ 4. Then run the spec to verify the generated content by `rake`
67
+
68
+ The data needed tweaks in several places:
69
+
70
+ 1. Currencies that don't have a decimal point causes "00", namely JPY and TWD. Replace "00" with "0 0"
71
+ 2. Tier 86 and 87 in MXN is broken. Fix the misplacement as appropriate.
72
+ 3. Tier 67 for in CHF and Tier 1 in SGD were broken. "103.7" and "0.9" were replaced with "103.70" and "0.90" respectively
data/Rakefile CHANGED
@@ -1,31 +1,35 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'rake'
11
-
12
- require 'jeweler'
13
- Jeweler::Tasks.new do |gem|
14
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
- gem.name = "app_store_pricing_matrix"
16
- gem.homepage = "http://github.com/kenn/app_store_pricing_matrix"
17
- gem.license = "MIT"
18
- gem.summary = "Constants for App Store Pricing Matrix"
19
- gem.description = "A simple module that holds currencies and prices from the Apple's iOS App Store."
20
- gem.email = "kenn.ejima@gmail.com"
21
- gem.authors = ["Kenn Ejima", "Elliot Bowes"]
22
- end
23
- Jeweler::RubygemsDotOrgTasks.new
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
24
3
 
25
- require 'rspec/core'
4
+ # RSpec
26
5
  require 'rspec/core/rake_task'
27
- RSpec::Core::RakeTask.new(:spec) do |spec|
28
- spec.pattern = FileList['spec/**/*_spec.rb']
29
- end
30
-
6
+ RSpec::Core::RakeTask.new('spec')
31
7
  task :default => :spec
8
+
9
+ # Compile
10
+ namespace :aspm do
11
+ desc "Parse PDF and generate files"
12
+ task :generate do
13
+ Dir['input/*.txt'].each do |file|
14
+ currency = File.basename(file, '.txt')
15
+ body = File.read file
16
+ array = body.split(/\s/)
17
+
18
+ amount = []
19
+ amount_pro = []
20
+
21
+ unless currency == 'gbp'
22
+ array.each_slice(2) do |slice|
23
+ amount << slice.first
24
+ amount_pro << slice.last
25
+ end
26
+ else
27
+ amount = array[0..87]
28
+ amount_pro = array[88..-1]
29
+ end
30
+
31
+ File.write("lib/prices/#{currency}", amount.join("\n"))
32
+ File.write("lib/prices/#{currency}_pro", amount_pro.join("\n"))
33
+ end
34
+ end
35
+ end
@@ -1,82 +1,22 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
5
2
 
6
- Gem::Specification.new do |s|
7
- s.name = "app_store_pricing_matrix"
8
- s.version = "1.3.0"
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Kenn Ejima", "Elliot Bowes"]
5
+ gem.email = ["kenn.ejima@gmail.com"]
6
+ gem.description = %q{A simple module that holds currencies and prices from the Apple's iOS App Store.}
7
+ gem.summary = %q{Constants for App Store Pricing Matrix}
8
+ gem.homepage = "http://github.com/kenn/app_store_pricing_matrix"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Kenn Ejima", "Elliot Bowes"]
12
- s.date = "2012-05-16"
13
- s.description = "A simple module that holds currencies and prices from the Apple's iOS App Store."
14
- s.email = "kenn.ejima@gmail.com"
15
- s.extra_rdoc_files = [
16
- "LICENSE.txt",
17
- "README.md"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".rspec",
22
- "Gemfile",
23
- "LICENSE.txt",
24
- "README.md",
25
- "Rakefile",
26
- "VERSION",
27
- "app_store_pricing_matrix.gemspec",
28
- "lib/app_store_pricing_matrix.rb",
29
- "lib/prices/aud",
30
- "lib/prices/aud_pro",
31
- "lib/prices/cad",
32
- "lib/prices/cad_pro",
33
- "lib/prices/chf",
34
- "lib/prices/chf_pro",
35
- "lib/prices/cny",
36
- "lib/prices/cny_pro",
37
- "lib/prices/dkk",
38
- "lib/prices/dkk_pro",
39
- "lib/prices/eur",
40
- "lib/prices/eur_pro",
41
- "lib/prices/gbp",
42
- "lib/prices/gbp_pro",
43
- "lib/prices/jpy",
44
- "lib/prices/jpy_pro",
45
- "lib/prices/mxn",
46
- "lib/prices/mxn_pro",
47
- "lib/prices/nok",
48
- "lib/prices/nok_pro",
49
- "lib/prices/nzd",
50
- "lib/prices/nzd_pro",
51
- "lib/prices/sek",
52
- "lib/prices/sek_pro",
53
- "lib/prices/usd",
54
- "lib/prices/usd_pro",
55
- "spec/app_store_pricing_matrix_spec.rb",
56
- "spec/spec_helper.rb"
57
- ]
58
- s.homepage = "http://github.com/kenn/app_store_pricing_matrix"
59
- s.licenses = ["MIT"]
60
- s.require_paths = ["lib"]
61
- s.rubygems_version = "1.8.19"
62
- s.summary = "Constants for App Store Pricing Matrix"
10
+ gem.files = `git ls-files`.split($\)
11
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
+ gem.name = "app_store_pricing_matrix"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = '2.0.0' # retrieve this value by: Gem.loaded_specs['app_store_pricing_matrix'].version.to_s
63
16
 
64
- if s.respond_to? :specification_version then
65
- s.specification_version = 3
17
+ gem.add_development_dependency "rspec"
18
+ gem.add_development_dependency "bundler"
66
19
 
67
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
68
- s.add_development_dependency(%q<rspec>, [">= 0"])
69
- s.add_development_dependency(%q<bundler>, [">= 0"])
70
- s.add_development_dependency(%q<jeweler>, [">= 0"])
71
- else
72
- s.add_dependency(%q<rspec>, [">= 0"])
73
- s.add_dependency(%q<bundler>, [">= 0"])
74
- s.add_dependency(%q<jeweler>, [">= 0"])
75
- end
76
- else
77
- s.add_dependency(%q<rspec>, [">= 0"])
78
- s.add_dependency(%q<bundler>, [">= 0"])
79
- s.add_dependency(%q<jeweler>, [">= 0"])
80
- end
20
+ # For Travis
21
+ gem.add_development_dependency "rake"
81
22
  end
82
-
data/input/aud.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0.00 0.99 0.63 1.99 1.27 2.99 1.90 4.49 2.86 5.49 3.49 6.49 4.13 7.49 4.77 8.49 5.40 9.49 6.04 10.49 6.68 11.49 7.31 12.99 8.27 13.99 8.90 14.99 9.54 15.99 10.18 16.99 10.81 17.99 11.45 18.99 12.08 19.99 12.72 20.99 13.36 21.99 13.99 22.99 14.63 23.99 15.27 24.99 15.90 25.99 16.54 26.99 17.18 27.99 17.81 29.99 19.08 30.99 19.72 31.99 20.36 32.99 20.99 33.99 21.63 34.99 22.27 35.99 22.90 36.99 23.54 37.99 24.18 38.99 24.81 39.99 25.45 40.99 26.08 41.99 26.72 42.99 27.36 43.99 27.99 44.99 28.63 45.99 29.27 46.99 29.90 47.99 30.54 48.99 31.18 49.99 31.81 50.99 32.45 51.99 33.08 59.99 38.18 64.99 41.36 69.99 44.54 74.99 47.72 79.99 50.90 84.99 54.08 89.99 57.27 94.99 60.45 99.99 63.63 109.99 69.99 119.99 76.36 129.99 82.72 134.99 85.90 139.99 89.08 149.99 95.45 159.99 101.81 169.99 108.18 179.99 114.54 184.99 117.72 189.99 120.90 199.99 127.27 209.99 133.63 219.99 139.99 229.99 146.36 239.99 152.72 249.99 159.08 269.99 171.81 319.99 203.63 379.99 241.81 429.99 273.63 499.99 318.18 549.99 349.99 649.99 413.63 749.99 477.27 849.99 540.90 949.99 604.54 1049.99 668.18
data/input/cad.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0.00 0.99 0.70 1.99 1.40 2.99 2.10 3.99 2.80 4.99 3.50 5.99 4.20 6.99 4.90 7.99 5.60 8.99 6.30 9.99 7.00 10.99 7.70 11.99 8.40 12.99 9.10 13.99 9.80 14.99 10.50 15.99 11.20 16.99 11.90 17.99 12.60 18.99 13.30 19.99 14.00 20.99 14.70 21.99 15.40 22.99 16.10 23.99 16.80 24.99 17.50 25.99 18.20 26.99 18.90 27.99 19.60 28.99 20.30 29.99 21.00 30.99 21.70 31.99 22.40 32.99 23.10 33.99 23.80 34.99 24.50 35.99 25.20 36.99 25.90 37.99 26.60 38.99 27.30 39.99 28.00 40.99 28.70 41.99 29.40 42.99 30.10 43.99 30.80 44.99 31.50 45.99 32.20 46.99 32.90 47.99 33.60 48.99 34.30 49.99 35.00 54.99 38.50 59.99 42.00 64.99 45.50 69.99 49.00 74.99 52.50 79.99 56.00 84.99 59.50 89.99 63.00 94.99 66.50 99.99 70.00 109.99 77.00 119.99 84.00 124.99 87.50 129.99 91.00 139.99 98.00 149.99 105.00 159.99 112.00 169.99 119.00 174.99 122.50 179.99 126.00 189.99 133.00 199.99 140.00 209.99 147.00 219.99 154.00 229.99 161.00 239.99 168.00 249.99 175.00 299.99 210.00 349.99 245.00 399.99 280.00 449.99 315.00 499.99 350.00 599.99 420.00 699.99 490.00 799.99 560.00 899.99 630.00 999.99 700.00
data/input/chf.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0.00 1.00 0.65 2.00 1.30 3.00 1.94 4.00 2.59 5.00 3.24 6.00 3.89 7.00 4.54 8.00 5.19 9.00 5.83 10.00 6.48 11.00 7.13 12.00 7.78 13.00 8.43 14.00 9.07 15.00 9.72 16.00 10.37 17.00 11.02 18.00 11.67 19.00 12.31 20.00 12.96 21.00 13.61 22.00 14.26 23.00 14.91 24.00 15.56 25.00 16.20 26.00 16.85 27.00 17.50 28.00 18.15 28.50 18.47 29.00 18.80 30.00 19.44 31.00 20.09 32.00 20.74 33.00 21.39 34.00 22.04 35.00 22.69 36.00 23.33 37.00 23.98 38.00 24.63 39.00 25.28 40.00 25.93 41.00 26.57 42.00 27.22 43.00 27.87 44.00 28.52 45.00 29.17 46.00 29.81 47.00 30.46 47.50 30.79 48.00 31.11 55.00 35.65 60.00 38.89 65.00 42.13 70.00 45.37 75.00 48.61 80.00 51.85 85.00 55.09 90.00 58.33 95.00 61.57 100.00 64.81 110.00 71.30 120.00 77.78 125.00 81.02 130.00 84.26 140.00 90.74 150.00 97.22 160.00 103.70 170.00 110.19 175.00 113.43 180.00 116.67 190.00 123.15 200.00 129.63 210.00 136.11 220.00 142.59 230.00 149.07 240.00 155.56 250.00 162.04 300.00 194.44 350.00 226.85 400.00 259.26 450.00 291.67 500.00 324.07 600.00 388.89 700.00 453.70 800.00 518.52 900.00 583.33 1000.00 648.15
data/input/cny.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0.00 6.00 4.20 12.00 8.40 18.00 12.60 25.00 17.50 30.00 21.00 40.00 28.00 45.00 31.50 50.00 35.00 60.00 42.00 68.00 47.60 73.00 51.10 78.00 54.60 88.00 61.60 93.00 65.10 98.00 68.60 108.00 75.60 113.00 79.10 118.00 82.60 123.00 86.10 128.00 89.60 138.00 96.60 148.00 103.60 153.00 107.10 158.00 110.60 163.00 114.10 168.00 117.60 178.00 124.60 188.00 131.60 193.00 135.10 198.00 138.60 208.00 145.60 218.00 152.60 223.00 156.10 228.00 159.60 233.00 163.10 238.00 166.60 243.00 170.10 248.00 173.60 253.00 177.10 258.00 180.60 263.00 184.10 268.00 187.60 273.00 191.10 278.00 194.60 283.00 198.10 288.00 201.60 298.00 208.60 308.00 215.60 318.00 222.60 328.00 229.60 348.00 243.60 388.00 271.60 418.00 292.60 448.00 313.60 488.00 341.60 518.00 362.60 548.00 383.60 588.00 411.60 618.00 432.60 648.00 453.60 698.00 488.60 798.00 558.60 818.00 572.60 848.00 593.60 898.00 628.60 998.00 698.60 1048.00 733.60 1098.00 768.60 1148.00 803.60 1198.00 838.60 1248.00 873.60 1298.00 908.60 1398.00 978.60 1448.00 1013.60 1498.00 1048.60 1598.00 1118.60 1648.00 1153.60 1998.00 1398.60 2298.00 1608.60 2598.00 1818.60 2998.00 2098.60 3298.00 2308.60 3998.00 2798.60 4498.00 3148.60 4998.00 3498.60 5898.00 4128.60 6498.00 4548.60
data/input/dkk.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0.00 6.00 3.65 12.00 7.30 18.00 10.96 24.00 14.61 30.00 18.26 36.00 21.91 42.00 25.57 48.00 29.22 54.00 32.87 59.00 35.91 69.00 42.00 75.00 45.65 79.00 48.09 85.00 51.74 89.00 54.17 99.00 60.26 105.00 63.91 109.00 66.35 115.00 70.00 119.00 72.43 125.00 76.09 129.00 78.52 135.00 82.17 139.00 84.61 149.00 90.70 155.00 94.35 159.00 96.78 165.00 100.43 169.00 102.87 179.00 108.96 185.00 112.61 189.00 115.04 195.00 118.70 199.00 121.13 209.00 127.22 215.00 130.87 219.00 133.30 225.00 136.96 229.00 139.39 239.00 145.48 245.00 149.13 249.00 151.57 255.00 155.22 259.00 157.65 269.00 163.74 275.00 167.39 279.00 169.83 285.00 173.48 289.00 175.91 299.00 182.00 319.00 194.17 339.00 206.35 369.00 224.61 399.00 242.87 439.00 267.22 469.00 285.48 499.00 303.74 529.00 322.00 559.00 340.26 599.00 364.61 629.00 382.87 669.00 407.22 689.00 419.39 699.00 425.48 749.00 455.91 819.00 498.52 899.00 547.22 929.00 565.48 949.00 577.65 969.00 589.83 1039.00 632.43 1119.00 681.13 1199.00 729.83 1269.00 772.43 1349.00 821.13 1399.00 851.57 1499.00 912.43 1799.00 1095.04 1999.00 1216.78 2399.00 1460.26 2699.00 1642.87 2999.00 1825.48 3499.00 2129.83 3999.00 2434.17 4799.00 2921.13 5499.00 3347.22 5999.00 3651.57
data/input/eur.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0.00 0.79 0.48 1.59 0.97 2.39 1.45 2.99 1.82 3.99 2.43 4.99 3.04 5.49 3.34 5.99 3.65 6.99 4.25 7.99 4.86 8.99 5.47 9.99 6.08 10.49 6.39 10.99 6.69 11.99 7.30 12.99 7.91 13.99 8.52 14.49 8.82 14.99 9.12 15.99 9.73 16.99 10.34 17.99 10.95 18.49 11.25 18.99 11.56 19.99 12.17 20.99 12.78 21.49 13.08 21.99 13.39 22.99 13.99 23.99 14.60 24.99 15.21 25.49 15.52 25.99 15.82 26.99 16.43 27.99 17.04 28.99 17.65 29.49 17.95 29.99 18.25 30.99 18.86 31.99 19.47 32.99 20.08 33.49 20.39 33.99 20.69 34.99 21.30 35.99 21.91 36.99 22.52 37.49 22.82 37.99 23.12 38.99 23.73 39.99 24.34 42.99 26.17 44.99 27.39 49.99 30.43 54.99 33.47 59.99 36.52 62.99 38.34 64.99 39.56 69.99 42.60 74.99 45.65 79.99 48.69 84.99 51.73 89.99 54.78 92.99 56.60 94.99 57.82 99.99 60.86 109.99 66.95 119.99 73.04 124.99 76.08 127.99 77.91 129.99 79.12 139.99 85.21 149.99 91.30 159.99 97.39 169.99 103.47 179.99 109.56 189.99 115.65 199.99 121.73 239.99 146.08 279.99 170.43 319.99 194.78 359.99 219.12 399.99 243.47 479.99 292.17 559.99 340.86 639.99 389.56 719.99 438.25 799.99 486.95
data/input/gbp.txt ADDED
@@ -0,0 +1,2 @@
1
+ 0.00 0.69 1.49 1.99 2.49 2.99 3.99 4.99 5.49 5.99 6.99 7.49 7.99 8.99 9.99 10.49 10.99 11.99 12.99 13.49 13.99 14.99 15.49 15.99 16.99 17.49 17.99 18.99 19.49 19.99 20.99 21.99 22.49 22.99 23.99 24.49 24.99 25.99 26.99 27.49 27.99 28.99 29.49 29.99 30.99 31.99 32.49 32.99 33.99 34.49 34.99 37.99 39.99 44.99 47.99 49.99 54.99 57.99 59.99 64.99 69.99 74.99 79.99 84.99 89.99 94.99 99.99 109.99 119.99 122.99 124.99 129.99 139.99 144.99 149.99 159.99 169.99 174.99 199.99 249.99 299.99 324.99 349.99 399.99 499.99 549.99 599.99 699.99
2
+ 0.00 0.42 0.91 1.21 1.52 1.82 2.43 3.04 3.34 3.65 4.25 4.56 4.86 5.47 6.08 6.39 6.69 7.30 7.91 8.21 8.52 9.12 9.43 9.73 10.34 10.65 10.95 11.56 11.86 12.17 12.78 13.39 13.69 13.99 14.60 14.91 15.21 15.82 16.43 16.73 17.04 17.65 17.95 18.25 18.86 19.47 19.78 20.08 20.69 20.99 21.30 23.12 24.34 27.39 29.21 30.43 33.47 35.30 36.52 39.56 42.60 45.65 48.69 51.73 54.78 57.82 60.86 66.95 73.04 74.86 76.08 79.12 85.21 88.25 91.30 97.39 103.47 106.52 121.73 152.17 182.60 197.82 213.04 243.47 304.34 334.78 365.21 426.08
data/input/hkd.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0.00 8.00 5.60 15.00 10.50 23.00 16.10 28.00 19.60 38.00 26.60 48.00 33.60 53.00 37.10 58.00 40.60 68.00 47.60 78.00 54.60 83.00 58.10 88.00 61.60 98.00 68.60 108.00 75.60 118.00 82.60 123.00 86.10 128.00 89.60 138.00 96.60 148.00 103.60 158.00 110.60 163.00 114.10 168.00 117.60 178.00 124.60 188.00 131.60 198.00 138.60 203.00 142.10 208.00 145.60 218.00 152.60 228.00 159.60 238.00 166.60 243.00 170.10 248.00 173.60 258.00 180.60 268.00 187.60 278.00 194.60 283.00 198.10 288.00 201.60 298.00 208.60 308.00 215.60 318.00 222.60 323.00 226.10 328.00 229.60 338.00 236.60 348.00 243.60 358.00 250.60 363.00 254.10 368.00 257.60 378.00 264.60 388.00 271.60 398.00 278.60 418.00 292.60 448.00 313.60 488.00 341.60 548.00 383.60 588.00 411.60 618.00 432.60 648.00 453.60 688.00 481.60 748.00 523.60 788.00 551.60 848.00 593.60 888.00 621.60 988.00 691.60 1048.00 733.60 1088.00 761.60 1188.00 831.60 1248.00 873.60 1288.00 901.60 1388.00 971.60 1448.00 1013.60 1488.00 1041.60 1588.00 1111.60 1648.00 1153.60 1688.00 1181.60 1788.00 1251.60 1848.00 1293.60 1888.00 1321.60 2288.00 1601.60 2688.00 1881.60 3088.00 2161.60 3488.00 2441.60 3888.00 2721.60 4488.00 3141.60 4988.00 3491.60 5988.00 4191.60 6988.00 4891.60 7888.00 5521.60
data/input/jpy.txt ADDED
@@ -0,0 +1 @@
1
+ 0 0 85 60 170 119 250 175 350 245 450 315 500 350 600 420 700 490 800 560 850 595 900 630 1000 700 1100 770 1200 840 1300 910 1400 980 1500 1050 1600 1120 1650 1155 1700 1190 1800 1260 1900 1330 2000 1400 2100 1470 2200 1540 2300 1610 2400 1680 2450 1715 2500 1750 2600 1820 2700 1890 2800 1960 2900 2030 2950 2065 3000 2100 3100 2170 3200 2240 3300 2310 3400 2380 3450 2415 3500 2450 3600 2520 3700 2590 3800 2660 3900 2730 3950 2765 4000 2800 4100 2870 4200 2940 4300 3010 4800 3360 5200 3640 5700 3990 6100 4270 6500 4550 6900 4830 7400 5180 7800 5460 8200 5740 8500 5950 9500 6650 10500 7350 11000 7700 11500 8050 12500 8750 13000 9100 14000 9800 15000 10500 15500 10850 16000 11200 16500 11550 17000 11900 18000 12600 19000 13300 20000 14000 21000 14700 22000 15400 26000 18200 30000 21000 35000 24500 39000 27300 42500 29750 50000 35000 60000 42000 70000 49000 80000 56000 85000 59500
data/input/mxn.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0.00 12.00 8.40 24.00 16.80 36.00 25.20 48.00 33.60 60.00 42.00 72.00 50.40 84.00 58.80 96.00 67.20 108.00 75.60 120.00 84.00 130.00 91.00 140.00 98.00 160.00 112.00 170.00 119.00 180.00 126.00 190.00 133.00 200.00 140.00 220.00 154.00 230.00 161.00 240.00 168.00 250.00 175.00 260.00 182.00 270.00 189.00 280.00 196.00 300.00 210.00 310.00 217.00 320.00 224.00 330.00 231.00 340.00 238.00 360.00 252.00 370.00 259.00 380.00 266.00 390.00 273.00 400.00 280.00 420.00 294.00 430.00 301.00 440.00 308.00 450.00 315.00 470.00 329.00 480.00 336.00 490.00 343.00 500.00 350.00 520.00 364.00 530.00 371.00 540.00 378.00 550.00 385.00 560.00 392.00 570.00 399.00 580.00 406.00 600.00 420.00 650.00 455.00 700.00 490.00 800.00 560.00 850.00 595.00 900.00 630.00 950.00 665.00 1000.00 700.00 1100.00 770.00 1150.00 805.00 1200.00 840.00 1300.00 910.00 1400.00 980.00 1500.00 1050.00 1600.00 1120.00 1700.00 1190.00 1800.00 1260.00 1900.00 1330.00 2000.00 1400.00 2100.00 1470.00 2200.00 1540.00 2300.00 1610.00 2400.00 1680.00 2500.00 1750.00 2700.00 1890.00 2800.00 1960.00 2900.00 2030.00 3000.00 2100.00 3600.00 2520.00 4200.00 2940.00 4800.00 3360.00 5400.00 3780.00 6000.00 4200.00 7200.00 5040.00 8400.00 5880.00 9600.00 6720.00 10800.00 7560.00 12000.00 8400.00
data/input/nok.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0.00 7.00 3.92 14.00 7.84 21.00 11.76 28.00 15.68 35.00 19.60 42.00 23.52 49.00 27.44 56.00 31.36 63.00 35.28 70.00 39.20 77.00 43.12 84.00 47.04 91.00 50.96 98.00 54.88 105.00 58.80 112.00 62.72 119.00 66.64 126.00 70.56 133.00 74.48 140.00 78.40 147.00 82.32 154.00 86.24 161.00 90.16 168.00 94.08 175.00 98.00 182.00 101.92 189.00 105.84 196.00 109.76 203.00 113.68 209.00 117.04 217.00 121.52 224.00 125.44 231.00 129.36 238.00 133.28 245.00 137.20 252.00 141.12 259.00 145.04 266.00 148.96 273.00 152.88 280.00 156.80 287.00 160.72 294.00 164.64 301.00 168.56 308.00 172.48 315.00 176.40 322.00 180.32 329.00 184.24 336.00 188.16 343.00 192.08 349.00 195.44 385.00 215.60 420.00 235.20 455.00 254.80 490.00 274.40 525.00 294.00 560.00 313.60 595.00 333.20 630.00 352.80 665.00 372.40 700.00 392.00 770.00 431.20 840.00 470.40 870.00 487.20 910.00 509.60 980.00 548.80 1050.00 588.00 1120.00 627.20 1190.00 666.40 1220.00 683.20 1260.00 705.60 1330.00 744.80 1400.00 784.00 1470.00 823.20 1540.00 862.40 1610.00 901.60 1680.00 940.80 1750.00 980.00 2100.00 1176.00 2450.00 1372.00 2800.00 1568.00 3150.00 1764.00 3500.00 1960.00 4200.00 2352.00 4900.00 2744.00 5600.00 3136.00 6300.00 3528.00 7000.00 3920.00
data/input/nzd.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0.00 1.29 0.90 2.59 1.81 4.19 2.93 5.29 3.70 6.49 4.54 8.29 5.80 9.99 6.99 10.99 7.69 12.99 9.09 13.99 9.79 14.99 10.49 15.99 11.19 16.99 11.89 17.99 12.59 18.99 13.29 19.99 13.99 20.99 14.69 22.99 16.09 23.99 16.79 24.99 17.49 25.99 18.19 27.99 19.59 28.99 20.29 29.99 20.99 30.99 21.69 32.99 23.09 34.99 24.49 35.99 25.19 36.99 25.89 38.99 27.29 39.99 27.99 40.99 28.69 41.99 29.39 43.99 30.79 44.99 31.49 45.99 32.19 46.99 32.89 47.99 33.59 48.99 34.29 49.99 34.99 50.99 35.69 51.99 36.39 53.99 37.79 54.99 38.49 55.99 39.19 56.99 39.89 58.99 41.29 59.99 41.99 60.99 42.69 64.99 45.49 74.99 52.49 79.99 55.99 84.99 59.49 94.99 66.49 99.99 69.99 104.99 73.49 109.99 76.99 114.99 80.49 119.99 83.99 124.99 87.49 149.99 104.99 159.99 111.99 164.99 115.49 169.99 118.99 179.99 125.99 199.99 139.99 209.99 146.99 229.99 160.99 234.99 164.49 239.99 167.99 249.99 174.99 259.99 181.99 269.99 188.99 279.99 195.99 289.99 202.99 299.99 209.99 319.99 223.99 399.99 279.99 449.99 314.99 499.99 349.99 549.99 384.99 649.99 454.99 749.99 524.99 849.99 594.99 949.99 664.99 1049.99 734.99 1249.99 874.99
data/input/sek.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0.00 7.00 4.26 15.00 9.13 22.00 13.39 28.00 17.04 38.00 23.13 45.00 27.39 49.00 29.83 55.00 33.48 65.00 39.57 75.00 45.65 85.00 51.74 95.00 57.83 99.00 60.26 105.00 63.91 109.00 66.35 119.00 72.43 129.00 78.52 135.00 82.17 139.00 84.61 149.00 90.70 159.00 96.78 169.00 102.87 175.00 106.52 179.00 108.96 189.00 115.04 195.00 118.70 199.00 121.13 209.00 127.22 219.00 133.30 229.00 139.39 235.00 143.04 239.00 145.48 245.00 149.13 249.00 151.57 265.00 161.30 269.00 163.74 275.00 167.39 285.00 173.48 289.00 175.91 299.00 182.00 309.00 188.09 315.00 191.74 319.00 194.17 329.00 200.26 339.00 206.35 345.00 210.00 349.00 212.43 359.00 218.52 369.00 224.61 379.00 230.70 399.00 242.87 419.00 255.04 469.00 285.48 519.00 315.91 569.00 346.35 599.00 364.61 619.00 376.78 659.00 401.13 699.00 425.48 749.00 455.91 799.00 486.35 849.00 516.78 879.00 535.04 899.00 547.22 949.00 577.65 999.00 608.09 1099.00 668.96 1179.00 717.65 1199.00 729.83 1239.00 754.17 1319.00 802.87 1399.00 851.57 1499.00 912.43 1599.00 973.30 1699.00 1034.17 1799.00 1095.04 1899.00 1155.91 2299.00 1399.39 2599.00 1582.00 2999.00 1825.48 3399.00 2068.96 3799.00 2312.43 4499.00 2738.52 5299.00 3225.48 5999.00 3651.57 6799.00 4138.52 7499.00 4564.61
data/input/sgd.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0 1.28 0.90 2.58 1.81 3.98 2.79 4.98 3.49 5.98 4.19 6.98 4.89 8.98 6.29 9.98 6.99 10.98 7.69 12.98 9.09 13.98 9.79 14.98 10.49 15.98 11.19 17.98 12.59 18.98 13.29 19.98 13.99 21.98 15.39 22.98 16.09 23.98 16.79 25.98 18.19 26.98 18.89 27.98 19.59 28.98 20.29 30.98 21.69 31.98 22.39 32.98 23.09 34.98 24.49 35.98 25.19 36.98 25.89 38.98 27.29 39.98 27.99 40.98 28.69 41.98 29.39 43.98 30.79 44.98 31.49 45.98 32.19 47.98 33.59 48.98 34.29 49.98 34.99 51.98 36.39 52.98 37.09 53.98 37.79 54.98 38.49 56.98 39.89 57.98 40.59 58.98 41.29 60.98 42.69 61.98 43.39 62.98 44.09 64.98 45.49 68.98 48.29 74.98 52.49 78.98 55.29 88.98 62.29 94.98 66.49 98.98 69.29 104.98 73.49 108.98 76.29 118.98 83.29 128.98 90.29 138.98 97.29 148.98 104.29 158.98 111.29 168.98 118.29 178.98 125.29 188.98 132.29 198.98 139.29 208.98 146.29 218.98 153.29 228.98 160.29 238.98 167.29 258.98 181.29 268.98 188.29 278.98 195.29 288.98 202.29 298.98 209.29 308.98 216.29 368.98 258.29 428.98 300.29 488.98 342.29 588.98 412.29 648.98 454.29 788.98 552.29 888.98 622.29 988.98 692.29 1088.98 762.29 1288.98 902.29
data/input/twd.txt ADDED
@@ -0,0 +1 @@
1
+ 0 0 30 21 60 42 90 63 120 84 150 105 180 126 210 147 240 168 270 189 300 210 330 231 360 252 390 273 420 294 450 315 490 343 520 364 540 378 570 399 590 413 630 441 660 462 690 483 720 504 750 525 790 553 820 574 840 588 870 609 890 623 930 651 960 672 990 693 1020 714 1050 735 1090 763 1120 784 1140 798 1170 819 1190 833 1230 861 1260 882 1290 903 1320 924 1350 945 1390 973 1420 994 1440 1008 1470 1029 1490 1043 1590 1113 1790 1253 1990 1393 2090 1463 2190 1533 2390 1673 2490 1743 2690 1883 2790 1953 2990 2093 3290 2303 3590 2513 3790 2653 3890 2723 4190 2933 4490 3143 4790 3353 5090 3563 5290 3703 5390 3773 5690 3983 5990 4193 6290 4403 6590 4613 6890 4823 7190 5033 7490 5243 8990 6293 9990 6993 11900 8330 12900 9030 14900 10430 17900 12530 20900 14630 23900 16730 26900 18830 29900 20930
data/input/usd.txt ADDED
@@ -0,0 +1 @@
1
+ 0.00 0.00 0.99 0.70 1.99 1.40 2.99 2.10 3.99 2.80 4.99 3.50 5.99 4.20 6.99 4.90 7.99 5.60 8.99 6.30 9.99 7.00 10.99 7.70 11.99 8.40 12.99 9.10 13.99 9.80 14.99 10.50 15.99 11.20 16.99 11.90 17.99 12.60 18.99 13.30 19.99 14.00 20.99 14.70 21.99 15.40 22.99 16.10 23.99 16.80 24.99 17.50 25.99 18.20 26.99 18.90 27.99 19.60 28.99 20.30 29.99 21.00 30.99 21.70 31.99 22.40 32.99 23.10 33.99 23.80 34.99 24.50 35.99 25.20 36.99 25.90 37.99 26.60 38.99 27.30 39.99 28.00 40.99 28.70 41.99 29.40 42.99 30.10 43.99 30.80 44.99 31.50 45.99 32.20 46.99 32.90 47.99 33.60 48.99 34.30 49.99 35.00 54.99 38.50 59.99 42.00 64.99 45.50 69.99 49.00 74.99 52.50 79.99 56.00 84.99 59.50 89.99 63.00 94.99 66.50 99.99 70.00 109.99 77.00 119.99 84.00 124.99 87.50 129.99 91.00 139.99 98.00 149.99 105.00 159.99 112.00 169.99 119.00 174.99 122.50 179.99 126.00 189.99 133.00 199.99 140.00 209.99 147.00 219.99 154.00 229.99 161.00 239.99 168.00 249.99 175.00 299.99 210.00 349.99 245.00 399.99 280.00 449.99 315.00 499.99 350.00 599.99 420.00 699.99 490.00 799.99 560.00 899.99 630.00 999.99 700.00
@@ -1,48 +1,23 @@
1
1
  module AppStorePricingMatrix
2
- CURRENCY_MAP = {
3
- :usd => [ :usd ].freeze,
4
- :cad => [ :cad ].freeze,
5
- :mxn => [ :mxn ].freeze,
6
- :aud => [ :aud ].freeze,
7
- :nzd => [ :nzd ].freeze,
8
- :jpy => [ :jpy ].freeze,
9
- :eur => [ :eur ].freeze,
10
- :chf => [ :chf ].freeze,
11
- :nok => [ :nok ].freeze,
12
- :gbp => [ :gbp ].freeze,
13
- :cny => [ :cny ].freeze,
14
- :dkk => [ :dkk ].freeze,
15
- :sek => [ :sek ].freeze
16
- }.freeze
17
-
18
- EURO_CURRENCIES = [ :bgn , :czk , :eek , :huf , :lvl , :ltl , :mtl , :pln , :ron ].map {|i| i.to_s.upcase }.freeze
19
- CUSTOMER_CURRENCIES = CURRENCY_MAP.values.flatten.map{|i| i.to_s.upcase }.freeze
20
- DEVELOPER_CURRENCIES = CURRENCY_MAP.keys.map{|i| i.to_s.upcase }.freeze
21
-
22
- REVERSE_CURRENCY_MAP = {}.tap do |hash|
23
- CURRENCY_MAP.keys.each do |key|
24
- CURRENCY_MAP[key].each do |customer_currency|
25
- hash[customer_currency.to_s.upcase] = key.to_s.upcase
26
- end
27
- end
28
- end.freeze
2
+ CURRENCIES = %w(USD CAD MXN AUD NZD JPY EUR DKK SEK CHF NOK GBP CNY SGD HKD TWD).freeze
3
+ EURO_CURRENCIES = %w(BGN CZK EEK HUF LVL LTL MTL PLN RON).freeze
29
4
 
30
5
  CUSTOMER_PRICES = {}.tap do |hash|
31
- CUSTOMER_CURRENCIES.map do |currency|
6
+ CURRENCIES.each do |currency|
32
7
  hash[currency] = File.read("#{File.dirname(__FILE__)}/prices/#{currency.downcase}").split("\n").freeze
33
8
  end
34
9
  end.freeze
35
10
 
36
11
  DEVELOPER_PROCEEDS = {}.tap do |hash|
37
- DEVELOPER_CURRENCIES.each do |key|
38
- hash[key] = File.read("#{File.dirname(__FILE__)}/prices/#{key.downcase}_pro").split("\n").freeze
12
+ CURRENCIES.each do |currency|
13
+ hash[currency] = File.read("#{File.dirname(__FILE__)}/prices/#{currency.downcase}_pro").split("\n").freeze
39
14
  end
40
15
  end.freeze
41
16
 
42
17
  def self.customer_currency_for(currency_code)
43
18
  code = currency_code.to_s.upcase
44
- return code if AppStorePricingMatrix::CUSTOMER_CURRENCIES.include? code
45
- return "EUR" if AppStorePricingMatrix::EURO_CURRENCIES.include? code
19
+ return code if CURRENCIES.include? code
20
+ return 'EUR' if EURO_CURRENCIES.include? code
46
21
  return nil
47
22
  end
48
23
  end
data/lib/prices/cny CHANGED
@@ -1,88 +1,88 @@
1
- 0
2
- 6
3
- 12
4
- 18
5
- 25
6
- 30
7
- 40
8
- 45
9
- 50
10
- 60
11
- 68
12
- 73
13
- 78
14
- 88
15
- 93
16
- 98
17
- 108
18
- 113
19
- 118
20
- 123
21
- 128
22
- 138
23
- 148
24
- 153
25
- 158
26
- 163
27
- 168
28
- 178
29
- 188
30
- 193
31
- 198
32
- 208
33
- 218
34
- 223
35
- 228
36
- 233
37
- 238
38
- 243
39
- 248
40
- 253
41
- 258
42
- 263
43
- 268
44
- 273
45
- 278
46
- 283
47
- 288
48
- 298
49
- 308
50
- 318
51
- 328
52
- 348
53
- 388
54
- 418
55
- 448
56
- 488
57
- 518
58
- 548
59
- 588
60
- 618
61
- 648
62
- 698
63
- 798
64
- 818
65
- 848
66
- 898
67
- 998
68
- 1048
69
- 1098
70
- 1148
71
- 1198
72
- 1248
73
- 1298
74
- 1398
75
- 1448
76
- 1498
77
- 1598
78
- 1648
79
- 1998
80
- 2298
81
- 2598
82
- 2998
83
- 3298
84
- 3998
85
- 4498
86
- 4998
87
- 5898
88
- 6498
1
+ 0.00
2
+ 6.00
3
+ 12.00
4
+ 18.00
5
+ 25.00
6
+ 30.00
7
+ 40.00
8
+ 45.00
9
+ 50.00
10
+ 60.00
11
+ 68.00
12
+ 73.00
13
+ 78.00
14
+ 88.00
15
+ 93.00
16
+ 98.00
17
+ 108.00
18
+ 113.00
19
+ 118.00
20
+ 123.00
21
+ 128.00
22
+ 138.00
23
+ 148.00
24
+ 153.00
25
+ 158.00
26
+ 163.00
27
+ 168.00
28
+ 178.00
29
+ 188.00
30
+ 193.00
31
+ 198.00
32
+ 208.00
33
+ 218.00
34
+ 223.00
35
+ 228.00
36
+ 233.00
37
+ 238.00
38
+ 243.00
39
+ 248.00
40
+ 253.00
41
+ 258.00
42
+ 263.00
43
+ 268.00
44
+ 273.00
45
+ 278.00
46
+ 283.00
47
+ 288.00
48
+ 298.00
49
+ 308.00
50
+ 318.00
51
+ 328.00
52
+ 348.00
53
+ 388.00
54
+ 418.00
55
+ 448.00
56
+ 488.00
57
+ 518.00
58
+ 548.00
59
+ 588.00
60
+ 618.00
61
+ 648.00
62
+ 698.00
63
+ 798.00
64
+ 818.00
65
+ 848.00
66
+ 898.00
67
+ 998.00
68
+ 1048.00
69
+ 1098.00
70
+ 1148.00
71
+ 1198.00
72
+ 1248.00
73
+ 1298.00
74
+ 1398.00
75
+ 1448.00
76
+ 1498.00
77
+ 1598.00
78
+ 1648.00
79
+ 1998.00
80
+ 2298.00
81
+ 2598.00
82
+ 2998.00
83
+ 3298.00
84
+ 3998.00
85
+ 4498.00
86
+ 4998.00
87
+ 5898.00
88
+ 6498.00