scrumninja 0.1.4 → 0.1.5
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/Gemfile.lock +1 -1
- data/lib/scrumninja.rb +8 -0
- data/lib/scrumninja/client.rb +48 -1
- data/lib/scrumninja/version.rb +1 -1
- data/spec/scrumninja_spec.rb +57 -10
- metadata +16 -16
data/Gemfile.lock
CHANGED
data/lib/scrumninja.rb
CHANGED
@@ -33,6 +33,10 @@ module ScrumNinja
|
|
33
33
|
client(api_key).project_card_wall project_id
|
34
34
|
end
|
35
35
|
|
36
|
+
def self.project_sprint_card_wall(api_key,project_id,sprint_id)
|
37
|
+
client(api_key).project_sprint_card_wall project_id, sprint_id
|
38
|
+
end
|
39
|
+
|
36
40
|
def self.project_roles(api_key,project_id)
|
37
41
|
client(api_key).project_roles project_id
|
38
42
|
end
|
@@ -52,4 +56,8 @@ module ScrumNinja
|
|
52
56
|
def self.project_burndown(api_key,project_id)
|
53
57
|
client(api_key).project_burndown project_id
|
54
58
|
end
|
59
|
+
|
60
|
+
def self.project_sprint_burndown(api_key,project_id,sprint_id)
|
61
|
+
client(api_key).project_sprint_burndown project_id, sprint_id
|
62
|
+
end
|
55
63
|
end
|
data/lib/scrumninja/client.rb
CHANGED
@@ -36,6 +36,11 @@ module ScrumNinja
|
|
36
36
|
response.tasks
|
37
37
|
end
|
38
38
|
|
39
|
+
def project_sprint_card_wall(project_id,sprint_id,options={})
|
40
|
+
response = get "http://scrumninja.com/projects/#{project_id}/sprints/#{sprint_id}/card_wall.xml", options
|
41
|
+
response.tasks
|
42
|
+
end
|
43
|
+
|
39
44
|
def project_roles(project_id,options={})
|
40
45
|
response = get "http://scrumninja.com/projects/#{project_id}/project_roles.xml", options
|
41
46
|
response.project_roles
|
@@ -57,7 +62,7 @@ module ScrumNinja
|
|
57
62
|
end
|
58
63
|
|
59
64
|
def project_burndown(project_id,options={})
|
60
|
-
burndown = Hashie::Mash.new
|
65
|
+
burndown = ::Hashie::Mash.new
|
61
66
|
card_wall = project_card_wall project_id, options
|
62
67
|
sprints = project_sprints project_id, options
|
63
68
|
|
@@ -99,6 +104,48 @@ module ScrumNinja
|
|
99
104
|
burndown
|
100
105
|
end
|
101
106
|
|
107
|
+
def project_sprint_burndown(project_id,sprint_id,options={})
|
108
|
+
burndown = ::Hashie::Mash.new
|
109
|
+
card_wall = project_sprint_card_wall project_id, sprint_id, options
|
110
|
+
sprint = project_sprint project_id, sprint_id, options
|
111
|
+
|
112
|
+
card_wall = [] if card_wall.nil?
|
113
|
+
|
114
|
+
start_date = sprint.starts_on.to_date
|
115
|
+
end_date = sprint.ends_on.to_date
|
116
|
+
|
117
|
+
burndown.start = start_date.to_time.to_i * 1000
|
118
|
+
burndown.sprint_length = (end_date - start_date).to_i + 1
|
119
|
+
days_passed = (Date.today - start_date).to_i + 1
|
120
|
+
# for each day in the sprint
|
121
|
+
burndown.estimates = []
|
122
|
+
days_passed.times do |i|
|
123
|
+
start_time = (start_date + i).to_time
|
124
|
+
end_time = (start_date + i + 1).to_time
|
125
|
+
total_hours = 0
|
126
|
+
card_wall.each do |task|
|
127
|
+
if task.created_at < end_time
|
128
|
+
if task.done_at.nil? or task.done_at > end_time
|
129
|
+
# we have a task that counts towards today, dig into estimates
|
130
|
+
if task.estimates.estimate.is_a? Array then
|
131
|
+
estimate_hours = 0
|
132
|
+
task.estimates.estimate.each do |estimate|
|
133
|
+
estimate_day = estimate.date.to_date
|
134
|
+
break if(estimate_day.to_time > end_time)
|
135
|
+
estimate_hours = task.estimates.estimate[0].hours.to_f
|
136
|
+
end
|
137
|
+
total_hours += estimate_hours
|
138
|
+
else
|
139
|
+
total_hours += task.estimates.estimate.hours.to_f
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
burndown.estimates << total_hours
|
145
|
+
end
|
146
|
+
burndown
|
147
|
+
end
|
148
|
+
|
102
149
|
private
|
103
150
|
|
104
151
|
def connection
|
data/lib/scrumninja/version.rb
CHANGED
data/spec/scrumninja_spec.rb
CHANGED
@@ -25,7 +25,6 @@ describe ScrumNinja, ".projects" do
|
|
25
25
|
projects = ScrumNinja.projects(API_KEY)
|
26
26
|
projects.should be_an Array
|
27
27
|
projects[0].name.should == "Tutorial Project"
|
28
|
-
puts projects
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
@@ -48,7 +47,6 @@ describe ScrumNinja, ".project" do
|
|
48
47
|
project = ScrumNinja.project(API_KEY,PROJECT_ID)
|
49
48
|
project.should be_an Hash
|
50
49
|
project.name.should == "Tutorial Project"
|
51
|
-
puts project
|
52
50
|
end
|
53
51
|
end
|
54
52
|
|
@@ -71,7 +69,6 @@ describe ScrumNinja, ".project_stories" do
|
|
71
69
|
stories = ScrumNinja.project_stories(API_KEY,PROJECT_ID)
|
72
70
|
stories.should be_an Array
|
73
71
|
stories[0].name.should == "Infrastructure for project"
|
74
|
-
puts stories[0]
|
75
72
|
end
|
76
73
|
end
|
77
74
|
|
@@ -94,7 +91,6 @@ describe ScrumNinja, ".project_backlog" do
|
|
94
91
|
sprints = ScrumNinja.project_backlog(API_KEY,PROJECT_ID)
|
95
92
|
sprints.should be_an Array
|
96
93
|
sprints[0].stories[0].name.should == "Reset Password"
|
97
|
-
puts sprints[0].stories[0]
|
98
94
|
end
|
99
95
|
end
|
100
96
|
|
@@ -117,7 +113,6 @@ describe ScrumNinja, ".project_sprints" do
|
|
117
113
|
sprints = ScrumNinja.project_sprints(API_KEY,PROJECT_ID)
|
118
114
|
sprints.should be_an Array
|
119
115
|
sprints[0].goal.should == "Learn how to use the system"
|
120
|
-
puts sprints[0]
|
121
116
|
end
|
122
117
|
end
|
123
118
|
|
@@ -140,7 +135,28 @@ describe ScrumNinja, ".project_card_wall" do
|
|
140
135
|
tasks = ScrumNinja.project_card_wall(API_KEY,PROJECT_ID)
|
141
136
|
tasks.should be_an Array
|
142
137
|
tasks[0].name.should == "configure database.yml"
|
143
|
-
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# The project_sprint_card_wall method
|
142
|
+
describe ScrumNinja, ".project_sprint_card_wall" do
|
143
|
+
before do
|
144
|
+
stub_request(:get, "http://scrumninja.com/projects/#{PROJECT_ID}/sprints/#{SPRINT_ID}/card_wall.xml").
|
145
|
+
with(:query => {:api_key => API_KEY}).
|
146
|
+
to_return(:body => fixture('card_wall.xml'), :headers => {'Content-Type' => 'application/xml; charset=utf-8'})
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should request the correct resource" do
|
150
|
+
ScrumNinja.project_sprint_card_wall(API_KEY,PROJECT_ID,SPRINT_ID)
|
151
|
+
a_request(:get, "http://scrumninja.com/projects/#{PROJECT_ID}/sprints/#{SPRINT_ID}/card_wall.xml").
|
152
|
+
with(:query => {:api_key => API_KEY}).
|
153
|
+
should have_been_made
|
154
|
+
end
|
155
|
+
|
156
|
+
it "should return the correct results" do
|
157
|
+
tasks = ScrumNinja.project_sprint_card_wall(API_KEY,PROJECT_ID,SPRINT_ID)
|
158
|
+
tasks.should be_an Array
|
159
|
+
tasks[0].name.should == "configure database.yml"
|
144
160
|
end
|
145
161
|
end
|
146
162
|
|
@@ -162,7 +178,6 @@ describe ScrumNinja, ".project_roles" do
|
|
162
178
|
it "should return the correct results" do
|
163
179
|
roles = ScrumNinja.project_roles(API_KEY,PROJECT_ID)
|
164
180
|
roles.should be_an Array
|
165
|
-
puts roles[0]
|
166
181
|
roles[0].user.first_name.should == "Javier"
|
167
182
|
end
|
168
183
|
end
|
@@ -185,7 +200,6 @@ describe ScrumNinja, ".project_sprint" do
|
|
185
200
|
it "should return the correct results" do
|
186
201
|
sprint = ScrumNinja.project_sprint(API_KEY,PROJECT_ID,SPRINT_ID)
|
187
202
|
sprint.should be_an Hash
|
188
|
-
puts sprint[0]
|
189
203
|
sprint.goal.should == "Learn how to use the system"
|
190
204
|
end
|
191
205
|
end
|
@@ -208,7 +222,6 @@ describe ScrumNinja, ".project_story" do
|
|
208
222
|
it "should return the correct results" do
|
209
223
|
story = ScrumNinja.project_story(API_KEY,PROJECT_ID,STORY_ID)
|
210
224
|
story.should be_an Hash
|
211
|
-
puts story[0]
|
212
225
|
story.name.should == "Infrastructure for project"
|
213
226
|
end
|
214
227
|
end
|
@@ -247,6 +260,41 @@ describe ScrumNinja, ".project_burndown" do
|
|
247
260
|
end
|
248
261
|
end
|
249
262
|
|
263
|
+
# The project_sprint_burndown method
|
264
|
+
describe ScrumNinja, ".project_sprint_burndown" do
|
265
|
+
before do
|
266
|
+
# project_burndown uses the cardwall
|
267
|
+
stub_request(:get, "http://scrumninja.com/projects/#{PROJECT_ID}/sprints/#{SPRINT_ID}/card_wall.xml").
|
268
|
+
with(:query => {:api_key => API_KEY}).
|
269
|
+
to_return(:body => fixture('card_wall.xml'), :headers => {'Content-Type' => 'application/xml; charset=utf-8'})
|
270
|
+
|
271
|
+
# project_backlog also uses the sprints
|
272
|
+
stub_request(:get, "http://scrumninja.com/projects/#{PROJECT_ID}/sprints/#{SPRINT_ID}.xml").
|
273
|
+
with(:query => {:api_key => API_KEY}).
|
274
|
+
to_return(:body => fixture('sprint.xml'), :headers => {'Content-Type' => 'application/xml; charset=utf-8'})
|
275
|
+
end
|
276
|
+
|
277
|
+
it "should request the correct resource" do
|
278
|
+
ScrumNinja.project_sprint_burndown(API_KEY,PROJECT_ID,SPRINT_ID)
|
279
|
+
a_request(:get, "http://scrumninja.com/projects/#{PROJECT_ID}/sprints/#{SPRINT_ID}/card_wall.xml").
|
280
|
+
with(:query => {:api_key => API_KEY}).
|
281
|
+
should have_been_made
|
282
|
+
|
283
|
+
a_request(:get, "http://scrumninja.com/projects/#{PROJECT_ID}/sprints/#{SPRINT_ID}.xml").
|
284
|
+
with(:query => {:api_key => API_KEY}).
|
285
|
+
should have_been_made
|
286
|
+
end
|
287
|
+
|
288
|
+
it "should return the correct results" do
|
289
|
+
burndown = ScrumNinja.project_sprint_burndown(API_KEY,PROJECT_ID,SPRINT_ID)
|
290
|
+
burndown.should be_an Hash
|
291
|
+
burndown.start.should == 1307602800000
|
292
|
+
burndown.estimates[0].should == 2.5
|
293
|
+
burndown.sprint_length.should == 14
|
294
|
+
end
|
295
|
+
end
|
296
|
+
|
297
|
+
|
250
298
|
# The story_tasks method
|
251
299
|
describe ScrumNinja, ".story_tasks" do
|
252
300
|
before do
|
@@ -266,7 +314,6 @@ describe ScrumNinja, ".story_tasks" do
|
|
266
314
|
tasks = ScrumNinja.story_tasks(API_KEY,STORY_ID)
|
267
315
|
tasks.should be_an Array
|
268
316
|
tasks[0].name.should == "configure database.yml"
|
269
|
-
puts tasks[0]
|
270
317
|
end
|
271
318
|
end
|
272
319
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrumninja
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-06-
|
12
|
+
date: 2011-06-28 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &2157765780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.6'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2157765780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: webmock
|
27
|
-
requirement: &
|
27
|
+
requirement: &2157765280 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '1.5'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2157765280
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: hashie
|
38
|
-
requirement: &
|
38
|
+
requirement: &2157764820 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2157764820
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: multi_xml
|
49
|
-
requirement: &
|
49
|
+
requirement: &2157764360 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.2.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2157764360
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: faraday_middleware
|
60
|
-
requirement: &
|
60
|
+
requirement: &2157763900 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.6.0
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2157763900
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: hashie
|
71
|
-
requirement: &
|
71
|
+
requirement: &2157763440 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.0.0
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2157763440
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: multi_xml
|
82
|
-
requirement: &
|
82
|
+
requirement: &2157762980 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: 0.2.0
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2157762980
|
91
91
|
description: Wrapper for the Scrumninja backlog/sprint management tool.
|
92
92
|
email: javier@granicus.com
|
93
93
|
executables: []
|