itunes-connect 0.9.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.
@@ -0,0 +1,5 @@
1
+ Provider Provider Country Vendor Identifier UPC ISRC Artist / Show Title / Episode / Season Label/Studio/Network Product Type Identifier Units Royalty Price Begin Date End Date Customer Currency Country Code Royalty Currency Preorder Season Pass ISAN Apple Identifier Customer Price CMA Asset/Content Flavor Vendor Offer Code Grid Promo Code Parent Identifier
2
+ APPLE US 1234 Evri EvriVerse 1 1 0 08/31/2009 08/31/2009 USD US USD 312716560 0
3
+ APPLE US 1234 Evri EvriVerse 7 3 0 08/31/2009 08/31/2009 USD US USD 312716560 0
4
+ APPLE US 1234 Evri EvriVerse 7 1 0 08/31/2009 08/31/2009 GBP GB GBP 312716560 0
5
+ APPLE US 1234 Evri EvriVerse 7 1 0 08/31/2009 08/31/2009 USD AR USD 312716560 0
@@ -0,0 +1,37 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe ItunesConnect::Report do
4
+ describe 'when constructed with raw input' do
5
+ before(:each) do
6
+ @report = ItunesConnect::Report.new(read_fixture('fixtures/report.txt'))
7
+ @today = Date.parse('8/31/2009')
8
+ end
9
+
10
+ it 'should produce a correct "data" member field' do
11
+ @report.data.should == {
12
+ 'US' => { :upgrade => 3, :install => 1, :date => @today },
13
+ 'GB' => { :upgrade => 1, :date => @today },
14
+ 'AR' => { :upgrade => 1, :date => @today }
15
+ }
16
+ end
17
+
18
+ it 'should yield each country with "each"' do
19
+ the_day = Date.parse('8/31/2009')
20
+ all = @report.sort_by { |r| r.country }
21
+ all[0].country.should == 'AR'
22
+ all[0].install_count.should == 0
23
+ all[0].upgrade_count.should == 1
24
+ all[0].date.should == the_day
25
+
26
+ all[1].country.should == 'GB'
27
+ all[1].install_count.should == 0
28
+ all[1].upgrade_count.should == 1
29
+ all[1].date.should == the_day
30
+
31
+ all[2].country.should == 'US'
32
+ all[2].install_count.should == 1
33
+ all[2].upgrade_count.should == 3
34
+ all[2].date.should == the_day
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,13 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'itunes_connect'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
10
+
11
+ def read_fixture(rel_path)
12
+ File.readlines(File.join(File.dirname(__FILE__), rel_path)).join("\n")
13
+ end
@@ -0,0 +1,142 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+ require "sqlite3"
3
+ require "tmpdir"
4
+
5
+ describe ItunesConnect::Store do
6
+
7
+ before(:each) do
8
+ @tempdir = Dir.tmpdir
9
+ @file = File.join(@tempdir, "store.db")
10
+ @store = ItunesConnect::Store.new(@file)
11
+ @today = Date.parse('9/9/2009')
12
+ end
13
+
14
+ after(:each) do
15
+ FileUtils.rm @file
16
+ end
17
+
18
+ describe "Adding rows" do
19
+ it 'should return true for newly imported rows' do
20
+ @store.add(@today, 'US', 1, 2).should be_true
21
+ end
22
+
23
+ it 'should return false for duplicate rows' do
24
+ @store.add(@today, 'US', 1, 2).should be_true
25
+ @store.add(@today, 'US', 1, 2).should be_false
26
+ end
27
+ end
28
+
29
+ describe 'counts' do
30
+ before(:each) do
31
+ @store.add(@today, 'US', 10, 20)
32
+ @store.add(@today - 1, 'US', 11, 21)
33
+ @store.add(@today, 'GB', 5, 15)
34
+ @store.add(@today - 1, 'GB', 6, 16)
35
+ @store.add(@today, 'FR', 7, 17)
36
+ end
37
+
38
+ it 'should return all rows with no constraints' do
39
+ @store.counts.size.should == 5
40
+ end
41
+
42
+ it 'should respect the :country constraint' do
43
+ @store.counts(:country => 'US').size.should == 2
44
+ @store.counts(:country => 'GB').size.should == 2
45
+ @store.counts(:country => 'FR').size.should == 1
46
+ end
47
+
48
+ it 'should respect the :to constraint' do
49
+ @store.counts(:to => @today).size.should == 5
50
+ @store.counts(:to => @today - 1).size.should == 2
51
+ end
52
+
53
+ it 'should respect the :from constraint' do
54
+ @store.counts(:from => @today).size.should == 3
55
+ @store.counts(:from => @today - 1).size.should == 5
56
+ @store.counts(:from => @today - 2).size.should == 5
57
+ end
58
+
59
+ it 'should respect multiple constraints' do
60
+ @store.counts(:from => @today, :to => @today).size.should == 3
61
+ @store.counts(:from => @today,
62
+ :to => @today,
63
+ :country => 'US').size.should == 1
64
+ end
65
+
66
+ it 'should return the correct fields' do
67
+ record = @store.counts.first
68
+ record.should be_respond_to(:report_date)
69
+ record.should be_respond_to(:country)
70
+ record.should be_respond_to(:install_count)
71
+ record.should be_respond_to(:update_count)
72
+ end
73
+ end
74
+
75
+ describe 'country_counts' do
76
+ before(:each) do
77
+ @store.add(@today, 'US', 10, 20)
78
+ @store.add(@today - 1, 'US', 11, 21)
79
+ @store.add(@today, 'GB', 5, 15)
80
+ @store.add(@today - 1, 'GB', 6, 16)
81
+ @store.add(@today, 'FR', 7, 17)
82
+ end
83
+
84
+ it 'should return all countries with no constraints' do
85
+ map = map_results_by_country(@store.country_counts)
86
+ map.size.should == 3
87
+ map['FR'].install_count.should == 7
88
+ map['FR'].update_count.should == 17
89
+ map['GB'].install_count.should == 11
90
+ map['GB'].update_count.should == 31
91
+ map['US'].install_count.should == 21
92
+ map['US'].update_count.should == 41
93
+ end
94
+
95
+ it 'should respect the :country constraint' do
96
+ map = map_results_by_country(@store.country_counts(:country => 'US'))
97
+ map.size.should == 1
98
+ map['US'].install_count.should == 21
99
+ map['US'].update_count.should == 41
100
+ end
101
+
102
+ it 'should respect the :to constraint' do
103
+ r1 = map_results_by_country(@store.country_counts(:to => @today))
104
+ r1.size.should == 3
105
+ r1.keys.sort.should == %w(FR GB US)
106
+ r1['GB'].install_count.should == 11
107
+ r1['GB'].update_count.should == 31
108
+
109
+ r2 = map_results_by_country(@store.country_counts(:to => @today - 1))
110
+ r2.size.should == 2
111
+ r2.keys.sort.should == %w(GB US)
112
+ r2['GB'].install_count.should == 6
113
+ r2['GB'].update_count.should == 16
114
+ end
115
+
116
+ it 'should respect the :from constraint' do
117
+ r1 = map_results_by_country(@store.country_counts(:from => @today))
118
+ r1.size.should == 3
119
+ r1.keys.sort.should == %w(FR GB US)
120
+ r1['US'].install_count.should == 10
121
+ r1['US'].update_count.should == 20
122
+
123
+ r2 = map_results_by_country(@store.country_counts(:from => @today - 1))
124
+ r2.size.should == 3
125
+ r2.keys.sort.should == %w(FR GB US)
126
+ r2['US'].install_count.should == 21
127
+ r2['US'].update_count.should == 41
128
+ end
129
+
130
+ it 'should return the correct fields' do
131
+ record = @store.country_counts.first
132
+ record.should be_respond_to(:country)
133
+ record.should be_respond_to(:install_count)
134
+ record.should be_respond_to(:update_count)
135
+ end
136
+ end
137
+
138
+ def map_results_by_country(results)
139
+ Hash[*results.map { |result| [result.country, result] }.flatten]
140
+ end
141
+
142
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: itunes-connect
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Vollmer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-11-07 00:00:00 -08:00
13
+ default_executable: itunes_connect
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: httpclient
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ~>
22
+ - !ruby/object:Gem::Version
23
+ version: "2.1"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: nokogiri
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: "1.3"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: clip
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.0.1
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: sqlite3-ruby
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: "1.2"
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ type: :development
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: fakeweb
67
+ type: :development
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ description: Programmatic and command-line access to iTunes Connect Reports
76
+ email: alex.vollmer@gmail.com
77
+ executables:
78
+ - itunes_connect
79
+ extensions: []
80
+
81
+ extra_rdoc_files:
82
+ - LICENSE
83
+ - README.rdoc
84
+ files:
85
+ - bin/itunes_connect
86
+ - lib/itunes_connect.rb
87
+ - lib/itunes_connect/commands.rb
88
+ - lib/itunes_connect/commands/download.rb
89
+ - lib/itunes_connect/commands/help.rb
90
+ - lib/itunes_connect/commands/import.rb
91
+ - lib/itunes_connect/commands/report.rb
92
+ - lib/itunes_connect/connection.rb
93
+ - lib/itunes_connect/rc_file.rb
94
+ - lib/itunes_connect/report.rb
95
+ - lib/itunes_connect/store.rb
96
+ - spec/commands/download_spec.rb
97
+ - spec/commands/help_spec.rb
98
+ - spec/commands/import_spec.rb
99
+ - spec/commands/report_spec.rb
100
+ - spec/commands_spec.rb
101
+ - spec/connection_spec.rb
102
+ - spec/fakeweb/homepage
103
+ - spec/fixtures/report.txt
104
+ - spec/report_spec.rb
105
+ - spec/spec_helper.rb
106
+ - spec/store_spec.rb
107
+ - LICENSE
108
+ - README.rdoc
109
+ has_rdoc: true
110
+ homepage: http://github.com/alexvollmer/itunes-connect
111
+ licenses: []
112
+
113
+ post_install_message:
114
+ rdoc_options:
115
+ - --charset=UTF-8
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: "0"
123
+ version:
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: "0"
129
+ version:
130
+ requirements: []
131
+
132
+ rubyforge_project:
133
+ rubygems_version: 1.3.5
134
+ signing_key:
135
+ specification_version: 3
136
+ summary: Get your iTunes Connect Reports
137
+ test_files:
138
+ - spec/commands/download_spec.rb
139
+ - spec/commands/help_spec.rb
140
+ - spec/commands/import_spec.rb
141
+ - spec/commands/report_spec.rb
142
+ - spec/commands_spec.rb
143
+ - spec/connection_spec.rb
144
+ - spec/report_spec.rb
145
+ - spec/spec_helper.rb
146
+ - spec/store_spec.rb