app_store_pricing_matrix 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "http://rubygems.org"
2
+
3
+ group :development do
4
+ gem "rspec", "~> 2.5.0"
5
+ gem "bundler", "~> 1.0.0"
6
+ gem "jeweler", "~> 1.5.2"
7
+ gem "pdf-reader", ">= 0.9.1"
8
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,30 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ Ascii85 (1.0.0)
5
+ diff-lcs (1.1.2)
6
+ git (1.2.5)
7
+ jeweler (1.5.2)
8
+ bundler (~> 1.0.0)
9
+ git (>= 1.2.5)
10
+ rake
11
+ pdf-reader (0.9.1)
12
+ Ascii85 (>= 0.9)
13
+ rake (0.8.7)
14
+ rspec (2.5.0)
15
+ rspec-core (~> 2.5.0)
16
+ rspec-expectations (~> 2.5.0)
17
+ rspec-mocks (~> 2.5.0)
18
+ rspec-core (2.5.1)
19
+ rspec-expectations (2.5.0)
20
+ diff-lcs (~> 1.1.2)
21
+ rspec-mocks (2.5.0)
22
+
23
+ PLATFORMS
24
+ ruby
25
+
26
+ DEPENDENCIES
27
+ bundler (~> 1.0.0)
28
+ jeweler (~> 1.5.2)
29
+ pdf-reader (>= 0.9.1)
30
+ rspec (~> 2.5.0)
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Kenn Ejima
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,38 @@
1
+ = app_store_pricing_matrix
2
+
3
+ A simple module that holds currencies and prices from the Apple's iOS App Store.
4
+
5
+ == Install
6
+
7
+ gem install app_store_pricing_matrix
8
+
9
+ == Usage
10
+
11
+ Some constants:
12
+
13
+ AppStorePricingMatrix::CUSTOMER_CURRENCIES
14
+ => ["USD", "MXN", "CAD", "AUD", "NZD", "JPY", "EUR", "DKK", "NOK", "SEK", "CHF", "GBP"]
15
+
16
+ AppStorePricingMatrix::DEVELOPER_CURRENCIES
17
+ => ["USD", "CAD", "AUD", "JPY", "EUR", "GBP"]
18
+
19
+ To retrieve a customer price, query with the currency and the tier number:
20
+
21
+ AppStorePricingMatrix::CUSTOMER_PRICES['USD'][1]
22
+ => "0.99"
23
+
24
+ AppStorePricingMatrix::CUSTOMER_PRICES['JPY'][1]
25
+ => "115"
26
+
27
+ For developer proceeds:
28
+
29
+ AppStorePricingMatrix::DEVELOPER_PROCEEDS['GBP'][30]
30
+ => "10.95"
31
+
32
+ To retrieve a developer currency from a given customer currency:
33
+
34
+ AppStorePricingMatrix::REVERSE_CURRENCY_MAP['MXN']
35
+ => "USD"
36
+
37
+ AppStorePricingMatrix::REVERSE_CURRENCY_MAP['DKK']
38
+ => "EUR"
data/Rakefile ADDED
@@ -0,0 +1,124 @@
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"]
22
+ end
23
+ Jeweler::RubygemsDotOrgTasks.new
24
+
25
+ require 'rspec/core'
26
+ require 'rspec/core/rake_task'
27
+ RSpec::Core::RakeTask.new(:spec) do |spec|
28
+ spec.pattern = FileList['spec/**/*_spec.rb']
29
+ end
30
+
31
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
32
+ spec.pattern = 'spec/**/*_spec.rb'
33
+ spec.rcov = true
34
+ end
35
+
36
+ task :default => :spec
37
+
38
+ require 'rake/rdoctask'
39
+ Rake::RDocTask.new do |rdoc|
40
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
41
+
42
+ rdoc.rdoc_dir = 'rdoc'
43
+ rdoc.title = "app_store_pricing_matrix #{version}"
44
+ rdoc.rdoc_files.include('README*')
45
+ rdoc.rdoc_files.include('lib/**/*.rb')
46
+ end
47
+
48
+ namespace :aspm do
49
+ desc "Parse PDF and generate files"
50
+ task :generate do
51
+ require 'pdf-reader'
52
+ require 'pp'
53
+ require 'yaml'
54
+
55
+ receiver = PDF::Reader::RegisterReceiver.new
56
+ pdf = PDF::Reader.file("lib/prices/v6.pdf", receiver)
57
+
58
+ targets = receiver.callbacks.select{|callback| callback[:name] == :show_text }[17..-1].map{|i| i[:args].first }
59
+ split_at = 11*86-1
60
+
61
+ page1 = Hash.new{|h,k| h[k] = Array.new }.tap do |hash|
62
+ targets.each_with_index do |v,i|
63
+ next if i > split_at
64
+ key = case i % 11
65
+ when 0
66
+ :tier
67
+ when 1
68
+ :usd
69
+ when 2
70
+ :mxn
71
+ when 3
72
+ :usd_pro
73
+ when 4
74
+ :cad
75
+ when 5
76
+ :cad_pro
77
+ when 6
78
+ :aud
79
+ when 7
80
+ :nzd
81
+ when 8
82
+ :aud_pro
83
+ when 9
84
+ :jpy
85
+ when 10
86
+ :jpy_pro
87
+ end
88
+ hash[key.to_s] << v unless key == :tier
89
+ end
90
+ end
91
+
92
+ targets = targets[split_at+15..-1]
93
+ page2 = Hash.new{|h,k| h[k] = Array.new }.tap do |hash|
94
+ targets.each_with_index do |v,i|
95
+ key = case i % 9
96
+ when 0
97
+ :tier
98
+ when 1
99
+ :eur
100
+ when 2
101
+ :dkk
102
+ when 3
103
+ :nok
104
+ when 4
105
+ :sek
106
+ when 5
107
+ :chf
108
+ when 6
109
+ :eur_pro
110
+ when 7
111
+ :gbp
112
+ when 8
113
+ :gbp_pro
114
+ end
115
+ hash[key.to_s] << v unless key == :tier
116
+ end
117
+ end
118
+
119
+ whole = page1.merge(page2)
120
+ whole.keys.each do |key|
121
+ File.open("lib/prices/#{key}", 'w') {|file| file.write whole[key].join("\n") }
122
+ end
123
+ end
124
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,82 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{app_store_pricing_matrix}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Kenn Ejima"]
12
+ s.date = %q{2011-02-27}
13
+ s.description = %q{A simple module that holds currencies and prices from the Apple's iOS App Store.}
14
+ s.email = %q{kenn.ejima@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "app_store_pricing_matrix.gemspec",
29
+ "lib/app_store_pricing_matrix.rb",
30
+ "lib/prices/aud",
31
+ "lib/prices/aud_pro",
32
+ "lib/prices/cad",
33
+ "lib/prices/cad_pro",
34
+ "lib/prices/chf",
35
+ "lib/prices/dkk",
36
+ "lib/prices/eur",
37
+ "lib/prices/eur_pro",
38
+ "lib/prices/gbp",
39
+ "lib/prices/gbp_pro",
40
+ "lib/prices/jpy",
41
+ "lib/prices/jpy_pro",
42
+ "lib/prices/mxn",
43
+ "lib/prices/nok",
44
+ "lib/prices/nzd",
45
+ "lib/prices/sek",
46
+ "lib/prices/usd",
47
+ "lib/prices/usd_pro",
48
+ "spec/app_store_pricing_matrix_spec.rb",
49
+ "spec/spec_helper.rb"
50
+ ]
51
+ s.homepage = %q{http://github.com/kenn/app_store_pricing_matrix}
52
+ s.licenses = ["MIT"]
53
+ s.require_paths = ["lib"]
54
+ s.rubygems_version = %q{1.5.3}
55
+ s.summary = %q{Constants for App Store Pricing Matrix}
56
+ s.test_files = [
57
+ "spec/app_store_pricing_matrix_spec.rb",
58
+ "spec/spec_helper.rb"
59
+ ]
60
+
61
+ if s.respond_to? :specification_version then
62
+ s.specification_version = 3
63
+
64
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
65
+ s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
66
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
67
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
68
+ s.add_development_dependency(%q<pdf-reader>, [">= 0.9.1"])
69
+ else
70
+ s.add_dependency(%q<rspec>, ["~> 2.5.0"])
71
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
72
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
73
+ s.add_dependency(%q<pdf-reader>, [">= 0.9.1"])
74
+ end
75
+ else
76
+ s.add_dependency(%q<rspec>, ["~> 2.5.0"])
77
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
78
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
79
+ s.add_dependency(%q<pdf-reader>, [">= 0.9.1"])
80
+ end
81
+ end
82
+
@@ -0,0 +1,32 @@
1
+ module AppStorePricingMatrix
2
+ CURRENCY_MAP = {
3
+ :usd => [ :usd, :mxn ], # WARNING: MXN is a valid Mexican peso - there's no MXP, apparently.
4
+ :cad => [ :cad ],
5
+ :aud => [ :aud, :nzd ],
6
+ :jpy => [ :jpy ],
7
+ :eur => [ :eur, :dkk, :nok, :sek, :chf ],
8
+ :gbp => [ :gbp ]
9
+ }
10
+ CUSTOMER_CURRENCIES = CURRENCY_MAP.values.flatten.map{|i| i.to_s.upcase }
11
+ DEVELOPER_CURRENCIES = CURRENCY_MAP.keys.map{|i| i.to_s.upcase }
12
+
13
+ REVERSE_CURRENCY_MAP = {}.tap do |hash|
14
+ CURRENCY_MAP.keys.each do |key|
15
+ CURRENCY_MAP[key].each do |customer_currency|
16
+ hash[customer_currency.to_s.upcase] = key.to_s.upcase
17
+ end
18
+ end
19
+ end
20
+
21
+ CUSTOMER_PRICES = {}.tap do |hash|
22
+ CUSTOMER_CURRENCIES.map do |currency|
23
+ hash[currency] = File.read("#{File.dirname(__FILE__)}/prices/#{currency}").split("\n")
24
+ end
25
+ end
26
+
27
+ DEVELOPER_PROCEEDS = {}.tap do |hash|
28
+ DEVELOPER_CURRENCIES.each do |key|
29
+ hash[key] = File.read("#{File.dirname(__FILE__)}/prices/#{key}_pro").split("\n")
30
+ end
31
+ end
32
+ end
data/lib/prices/aud ADDED
@@ -0,0 +1,86 @@
1
+ 0.00
2
+ 1.19
3
+ 2.49
4
+ 3.99
5
+ 4.99
6
+ 5.99
7
+ 7.99
8
+ 8.99
9
+ 9.99
10
+ 11.99
11
+ 12.99
12
+ 13.99
13
+ 14.99
14
+ 15.99
15
+ 16.99
16
+ 17.99
17
+ 18.99
18
+ 19.99
19
+ 21.99
20
+ 22.99
21
+ 23.99
22
+ 24.99
23
+ 26.99
24
+ 27.99
25
+ 28.99
26
+ 29.99
27
+ 31.99
28
+ 32.99
29
+ 33.99
30
+ 34.99
31
+ 36.99
32
+ 37.99
33
+ 38.99
34
+ 39.99
35
+ 41.99
36
+ 42.99
37
+ 43.99
38
+ 44.99
39
+ 45.99
40
+ 46.99
41
+ 47.99
42
+ 48.99
43
+ 49.99
44
+ 51.99
45
+ 52.99
46
+ 53.99
47
+ 54.99
48
+ 56.99
49
+ 57.99
50
+ 58.99
51
+ 59.99
52
+ 69.99
53
+ 74.99
54
+ 79.99
55
+ 89.99
56
+ 94.99
57
+ 99.99
58
+ 104.99
59
+ 109.99
60
+ 114.99
61
+ 119.99
62
+ 139.99
63
+ 149.99
64
+ 159.99
65
+ 169.99
66
+ 189.99
67
+ 199.99
68
+ 219.99
69
+ 229.99
70
+ 239.99
71
+ 249.99
72
+ 259.99
73
+ 269.99
74
+ 279.99
75
+ 289.99
76
+ 299.99
77
+ 349.99
78
+ 399.99
79
+ 449.99
80
+ 499.99
81
+ 599.99
82
+ 699.99
83
+ 799.99
84
+ 899.99
85
+ 999.99
86
+ 1199.99
@@ -0,0 +1,86 @@
1
+ 0.00
2
+ 0.76
3
+ 1.58
4
+ 2.54
5
+ 3.18
6
+ 3.81
7
+ 5.08
8
+ 5.72
9
+ 6.36
10
+ 7.63
11
+ 8.27
12
+ 8.90
13
+ 9.54
14
+ 10.18
15
+ 10.81
16
+ 11.45
17
+ 12.08
18
+ 12.72
19
+ 13.99
20
+ 14.63
21
+ 15.27
22
+ 15.90
23
+ 17.18
24
+ 17.81
25
+ 18.45
26
+ 19.08
27
+ 20.36
28
+ 20.99
29
+ 21.63
30
+ 22.27
31
+ 23.54
32
+ 24.18
33
+ 24.81
34
+ 25.45
35
+ 26.72
36
+ 27.36
37
+ 27.99
38
+ 28.63
39
+ 29.27
40
+ 29.90
41
+ 30.54
42
+ 31.18
43
+ 31.81
44
+ 33.08
45
+ 33.72
46
+ 34.36
47
+ 34.99
48
+ 36.27
49
+ 36.90
50
+ 37.54
51
+ 38.18
52
+ 44.54
53
+ 47.72
54
+ 50.90
55
+ 57.27
56
+ 60.45
57
+ 63.63
58
+ 66.81
59
+ 69.99
60
+ 73.18
61
+ 76.36
62
+ 89.08
63
+ 95.45
64
+ 101.81
65
+ 108.18
66
+ 120.90
67
+ 127.27
68
+ 139.99
69
+ 146.36
70
+ 152.72
71
+ 159.08
72
+ 165.45
73
+ 171.81
74
+ 178.18
75
+ 184.54
76
+ 190.90
77
+ 222.72
78
+ 254.54
79
+ 286.36
80
+ 318.18
81
+ 381.81
82
+ 445.45
83
+ 509.08
84
+ 572.72
85
+ 636.36
86
+ 763.63
data/lib/prices/cad ADDED
@@ -0,0 +1,86 @@
1
+ 0.00
2
+ 0.99
3
+ 1.99
4
+ 2.99
5
+ 3.99
6
+ 4.99
7
+ 5.99
8
+ 6.99
9
+ 7.99
10
+ 8.99
11
+ 9.99
12
+ 10.99
13
+ 11.99
14
+ 12.99
15
+ 13.99
16
+ 14.99
17
+ 15.99
18
+ 16.99
19
+ 17.99
20
+ 18.99
21
+ 19.99
22
+ 20.99
23
+ 21.99
24
+ 22.99
25
+ 23.99
26
+ 24.99
27
+ 25.99
28
+ 26.99
29
+ 27.99
30
+ 28.99
31
+ 29.99
32
+ 30.99
33
+ 31.99
34
+ 32.99
35
+ 33.99
36
+ 34.99
37
+ 35.99
38
+ 36.99
39
+ 37.99
40
+ 38.99
41
+ 39.99
42
+ 40.99
43
+ 41.99
44
+ 42.99
45
+ 43.99
46
+ 44.99
47
+ 45.99
48
+ 46.99
49
+ 47.99
50
+ 48.99
51
+ 49.99
52
+ 54.99
53
+ 59.99
54
+ 64.99
55
+ 69.99
56
+ 74.99
57
+ 79.99
58
+ 84.99
59
+ 89.99
60
+ 94.99
61
+ 99.99
62
+ 109.99
63
+ 119.99
64
+ 129.99
65
+ 139.99
66
+ 149.99
67
+ 159.99
68
+ 169.99
69
+ 179.99
70
+ 189.99
71
+ 199.99
72
+ 209.99
73
+ 219.99
74
+ 229.99
75
+ 239.99
76
+ 249.99
77
+ 299.99
78
+ 349.99
79
+ 399.99
80
+ 449.99
81
+ 499.99
82
+ 599.99
83
+ 699.99
84
+ 799.99
85
+ 899.99
86
+ 999.99
@@ -0,0 +1,86 @@
1
+ 0.00
2
+ 0.70
3
+ 1.40
4
+ 2.10
5
+ 2.80
6
+ 3.50
7
+ 4.20
8
+ 4.90
9
+ 5.60
10
+ 6.30
11
+ 7.00
12
+ 7.70
13
+ 8.40
14
+ 9.10
15
+ 9.80
16
+ 10.50
17
+ 11.20
18
+ 11.90
19
+ 12.60
20
+ 13.30
21
+ 14.00
22
+ 14.70
23
+ 15.40
24
+ 16.10
25
+ 16.80
26
+ 17.50
27
+ 18.20
28
+ 18.90
29
+ 19.60
30
+ 20.30
31
+ 21.00
32
+ 21.70
33
+ 22.40
34
+ 23.10
35
+ 23.80
36
+ 24.50
37
+ 25.20
38
+ 25.90
39
+ 26.60
40
+ 27.30
41
+ 28.00
42
+ 28.70
43
+ 29.40
44
+ 30.10
45
+ 30.80
46
+ 31.50
47
+ 32.20
48
+ 32.90
49
+ 33.60
50
+ 34.30
51
+ 35.00
52
+ 38.50
53
+ 42.00
54
+ 45.50
55
+ 49.00
56
+ 52.50
57
+ 56.00
58
+ 59.50
59
+ 63.00
60
+ 66.50
61
+ 70.00
62
+ 77.00
63
+ 84.00
64
+ 91.00
65
+ 98.00
66
+ 105.00
67
+ 112.00
68
+ 119.00
69
+ 126.00
70
+ 133.00
71
+ 140.00
72
+ 147.00
73
+ 154.00
74
+ 161.00
75
+ 168.00
76
+ 175.00
77
+ 210.00
78
+ 245.00
79
+ 280.00
80
+ 315.00
81
+ 350.00
82
+ 420.00
83
+ 490.00
84
+ 560.00
85
+ 630.00
86
+ 700.00