itunes-connect 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,17 +12,17 @@ class ItunesConnect::Report
12
12
  # <tt>:install</tt>.
13
13
  attr_reader :data
14
14
 
15
- # Give me an +IO+-like object (one that responds to the +each+
15
+ # Give me an +IO+-like object (one that responds to the +each_line+
16
16
  # method) and I'll parse that sucker for you.
17
17
  def initialize(input)
18
18
  @data = Hash.new { |h,k| h[k] = { }}
19
- input.each do |line|
19
+ input.each_line do |line|
20
20
  line.chomp!
21
21
  next if line =~ /^(Provider|$)/
22
22
  tokens = line.split(/\s+/)
23
23
  country = tokens[11]
24
24
  count = tokens[6].to_i
25
- @data[country][:date] = Date.parse(tokens[8])
25
+ @data[country][:date] = Date.strptime(tokens[8], "%m/%d/%Y")
26
26
  case tokens[5].to_i
27
27
  when 7
28
28
  @data[country][:upgrade] = count
@@ -2,7 +2,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe ItunesConnect::Commands::Download do
4
4
  before(:each) do
5
- @cmd = ItunesConnect::Commands::Download.new(mock(:null_object => true),
5
+ @clip = mock(:clip)
6
+ @clip.stub!(:opt).and_return(nil)
7
+ @clip.stub!(:req).and_return(nil)
8
+ @clip.stub!(:flag).and_return(nil)
9
+
10
+ @cmd = ItunesConnect::Commands::Download.new(@clip,
6
11
  mock(:username => nil,
7
12
  :password => nil,
8
13
  :database => nil))
@@ -55,7 +60,7 @@ describe ItunesConnect::Commands::Download do
55
60
 
56
61
  describe 'and the :db option is specified' do
57
62
  it 'should import the results into the DB' do
58
- t = Date.parse('8/31/2009')
63
+ t = Date.strptime('8/31/2009', "%m/%d/%Y")
59
64
  @connection.should_receive(:get_report) do |date, io, report|
60
65
  io << read_fixture('fixtures/report.txt')
61
66
  io.flush
@@ -3,7 +3,12 @@ require "clip"
3
3
 
4
4
  describe ItunesConnect::Commands::Help do
5
5
  before(:each) do
6
- @cmd = ItunesConnect::Commands::Help.new(mock(:null_object => true))
6
+ @clip = mock(:clip)
7
+ @clip.stub!(:opt).and_return(nil)
8
+ @clip.stub!(:req).and_return(nil)
9
+ @clip.stub!(:flag).and_return(nil)
10
+
11
+ @cmd = ItunesConnect::Commands::Help.new(@clip)
7
12
  end
8
13
 
9
14
  describe 'with valid execution arguments' do
@@ -4,7 +4,12 @@ require "tempfile"
4
4
  describe ItunesConnect::Commands::Import do
5
5
 
6
6
  before(:each) do
7
- @cmd = ItunesConnect::Commands::Import.new(mock(:null_object => true),
7
+ @clip = mock(:clip)
8
+ @clip.stub!(:opt).and_return(nil)
9
+ @clip.stub!(:req).and_return(nil)
10
+ @clip.stub!(:flag).and_return(nil)
11
+
12
+ @cmd = ItunesConnect::Commands::Import.new(@clip,
8
13
  mock(:username => nil,
9
14
  :password => nil,
10
15
  :database => nil))
@@ -19,7 +24,7 @@ describe ItunesConnect::Commands::Import do
19
24
  end
20
25
 
21
26
  it 'should add a record to the store for each row of data' do
22
- t = Date.parse('8/31/2009')
27
+ t = Date.strptime('8/31/2009', "%m/%d/%Y")
23
28
  @store.should_receive(:add).with(t, 'GB', 0, 1)
24
29
  @store.should_receive(:add).with(t, 'AR', 0, 1)
25
30
  @store.should_receive(:add).with(t, 'US', 1, 3)
@@ -2,7 +2,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe ItunesConnect::Commands::Report do
4
4
  before(:each) do
5
- @cmd = ItunesConnect::Commands::Report.new(mock(:null_object => true))
5
+ @clip = mock(:clip)
6
+ @clip.stub!(:opt).and_return(nil)
7
+ @clip.stub!(:req).and_return(nil)
8
+ @clip.stub!(:flag).and_return(nil)
9
+
10
+ @cmd = ItunesConnect::Commands::Report.new(@clip)
6
11
  @defaults = {
7
12
  :db => '/tmp/store.db',
8
13
  :summarize? => false,
@@ -15,7 +15,10 @@ describe ItunesConnect::Commands do
15
15
 
16
16
  describe 'for_name' do
17
17
  before(:each) do
18
- @clip = mock(:null_object => true)
18
+ @clip = mock(:clip)
19
+ @clip.stub!(:opt).and_return(nil)
20
+ @clip.stub!(:req).and_return(nil)
21
+ @clip.stub!(:flag).and_return(nil)
19
22
  end
20
23
 
21
24
  it 'should return Download for download' do
@@ -4,7 +4,7 @@ describe ItunesConnect::Report do
4
4
  describe 'when constructed with raw input' do
5
5
  before(:each) do
6
6
  @report = ItunesConnect::Report.new(read_fixture('fixtures/report.txt'))
7
- @today = Date.parse('8/31/2009')
7
+ @today = Date.strptime('8/31/2009', "%m/%d/%Y")
8
8
  end
9
9
 
10
10
  it 'should produce a correct "data" member field' do
@@ -16,7 +16,7 @@ describe ItunesConnect::Report do
16
16
  end
17
17
 
18
18
  it 'should yield each country with "each"' do
19
- the_day = Date.parse('8/31/2009')
19
+ the_day = @today
20
20
  all = @report.sort_by { |r| r.country }
21
21
  all[0].country.should == 'AR'
22
22
  all[0].install_count.should == 0
@@ -1,10 +1,10 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
3
  require 'itunes_connect'
4
- require 'spec'
5
- require 'spec/autorun'
4
+ require 'rspec'
5
+ require 'rspec/autorun'
6
6
 
7
- Spec::Runner.configure do |config|
7
+ RSpec.configure do |config|
8
8
 
9
9
  end
10
10
 
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itunes-connect
3
3
  version: !ruby/object:Gem::Version
4
- hash: 51
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 11
7
+ - 12
9
8
  - 0
10
- version: 0.11.0
9
+ version: 0.12.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Alex Vollmer
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-10-09 00:00:00 +10:30
17
+ date: 2011-01-10 00:00:00 +10:30
19
18
  default_executable: itunes_connect
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
- hash: 23
30
28
  segments:
31
29
  - 1
32
30
  - 0
@@ -42,7 +40,6 @@ dependencies:
42
40
  requirements:
43
41
  - - ">="
44
42
  - !ruby/object:Gem::Version
45
- hash: 21
46
43
  segments:
47
44
  - 1
48
45
  - 0
@@ -58,7 +55,6 @@ dependencies:
58
55
  requirements:
59
56
  - - ~>
60
57
  - !ruby/object:Gem::Version
61
- hash: 11
62
58
  segments:
63
59
  - 1
64
60
  - 2
@@ -73,7 +69,6 @@ dependencies:
73
69
  requirements:
74
70
  - - ">="
75
71
  - !ruby/object:Gem::Version
76
- hash: 3
77
72
  segments:
78
73
  - 0
79
74
  version: "0"
@@ -87,7 +82,6 @@ dependencies:
87
82
  requirements:
88
83
  - - ">="
89
84
  - !ruby/object:Gem::Version
90
- hash: 3
91
85
  segments:
92
86
  - 0
93
87
  version: "0"
@@ -132,8 +126,8 @@ homepage: http://github.com/alexvollmer/itunes-connect
132
126
  licenses: []
133
127
 
134
128
  post_install_message:
135
- rdoc_options:
136
- - --charset=UTF-8
129
+ rdoc_options: []
130
+
137
131
  require_paths:
138
132
  - lib
139
133
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -141,7 +135,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
135
  requirements:
142
136
  - - ">="
143
137
  - !ruby/object:Gem::Version
144
- hash: 3
145
138
  segments:
146
139
  - 0
147
140
  version: "0"
@@ -150,7 +143,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
143
  requirements:
151
144
  - - ">="
152
145
  - !ruby/object:Gem::Version
153
- hash: 3
154
146
  segments:
155
147
  - 0
156
148
  version: "0"