agilezen 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +60 -0
- data/LICENSE +20 -0
- data/README.md +39 -0
- data/Rakefile +2 -0
- data/agilezen.gemspec +29 -0
- data/lib/agilezen.rb +11 -0
- data/lib/agilezen/client.rb +55 -0
- data/lib/agilezen/projects.rb +29 -0
- data/lib/agilezen/stories.rb +36 -0
- data/lib/agilezen/version.rb +4 -0
- data/spec/client_spec.rb +86 -0
- data/spec/fixtures/garbage.txt +27 -0
- data/spec/fixtures/project.json +9 -0
- data/spec/fixtures/project/15404-with-enrichments.json +86 -0
- data/spec/fixtures/projects-with-filtering.json +18 -0
- data/spec/fixtures/projects.json +26 -0
- data/spec/fixtures/spots.json +557 -0
- data/spec/fixtures/stories-page1.json +71 -0
- data/spec/fixtures/stories-page2.json +71 -0
- data/spec/fixtures/stories.json +52 -0
- data/spec/fixtures/story.json +22 -0
- data/spec/fixtures/story/2-with-enrichments.json +40 -0
- data/spec/fixtures/story/2-with-filtering.json +35 -0
- data/spec/projects_spec.rb +66 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/stories_spec.rb +84 -0
- data/spec/support/fakeweb_helper.rb +11 -0
- data/spec/support/matchers.rb +13 -0
- metadata +245 -0
@@ -0,0 +1,71 @@
|
|
1
|
+
{
|
2
|
+
"page": 1,
|
3
|
+
"pageSize": 3,
|
4
|
+
"totalPages": 4,
|
5
|
+
"totalItems": 10,
|
6
|
+
"items": [
|
7
|
+
{
|
8
|
+
"id": 1,
|
9
|
+
"text": "User registration",
|
10
|
+
"size": "2",
|
11
|
+
"color": "grey",
|
12
|
+
"ready": false,
|
13
|
+
"blocked": false,
|
14
|
+
"phase": {
|
15
|
+
"id": 87567,
|
16
|
+
"name": "Development"
|
17
|
+
},
|
18
|
+
"phaseIndex": 0,
|
19
|
+
"creator": {
|
20
|
+
"id": 19059,
|
21
|
+
"name": "Adam"
|
22
|
+
},
|
23
|
+
"owner": {
|
24
|
+
"id": 19059,
|
25
|
+
"name": "Adam"
|
26
|
+
}
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"id": 2,
|
30
|
+
"text": "User sign in",
|
31
|
+
"size": "2",
|
32
|
+
"color": "grey",
|
33
|
+
"ready": false,
|
34
|
+
"blocked": false,
|
35
|
+
"phase": {
|
36
|
+
"id": 87566,
|
37
|
+
"name": "Ready"
|
38
|
+
},
|
39
|
+
"phaseIndex": 0,
|
40
|
+
"creator": {
|
41
|
+
"id": 19059,
|
42
|
+
"name": "Adam"
|
43
|
+
},
|
44
|
+
"owner": {
|
45
|
+
"id": 19059,
|
46
|
+
"name": "Adam"
|
47
|
+
}
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"id": 3,
|
51
|
+
"text": "Create a post",
|
52
|
+
"size": "3",
|
53
|
+
"color": "grey",
|
54
|
+
"ready": false,
|
55
|
+
"blocked": false,
|
56
|
+
"phase": {
|
57
|
+
"id": 87565,
|
58
|
+
"name": "Backlog"
|
59
|
+
},
|
60
|
+
"phaseIndex": 0,
|
61
|
+
"creator": {
|
62
|
+
"id": 19059,
|
63
|
+
"name": "Adam"
|
64
|
+
},
|
65
|
+
"owner": {
|
66
|
+
"id": 19059,
|
67
|
+
"name": "Adam"
|
68
|
+
}
|
69
|
+
}
|
70
|
+
]
|
71
|
+
}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
{
|
2
|
+
"page": 2,
|
3
|
+
"pageSize": 3,
|
4
|
+
"totalPages": 4,
|
5
|
+
"totalItems": 10,
|
6
|
+
"items": [
|
7
|
+
{
|
8
|
+
"id": 4,
|
9
|
+
"text": "Add a post",
|
10
|
+
"size": "2",
|
11
|
+
"color": "grey",
|
12
|
+
"ready": false,
|
13
|
+
"blocked": false,
|
14
|
+
"phase": {
|
15
|
+
"id": 87565,
|
16
|
+
"name": "Backlog"
|
17
|
+
},
|
18
|
+
"phaseIndex": 1,
|
19
|
+
"creator": {
|
20
|
+
"id": 19059,
|
21
|
+
"name": "Adam"
|
22
|
+
},
|
23
|
+
"owner": {
|
24
|
+
"id": 19059,
|
25
|
+
"name": "Adam"
|
26
|
+
}
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"id": 5,
|
30
|
+
"text": "Edit a post",
|
31
|
+
"size": "",
|
32
|
+
"color": "grey",
|
33
|
+
"ready": false,
|
34
|
+
"blocked": false,
|
35
|
+
"phase": {
|
36
|
+
"id": 87565,
|
37
|
+
"name": "Backlog"
|
38
|
+
},
|
39
|
+
"phaseIndex": 2,
|
40
|
+
"creator": {
|
41
|
+
"id": 19059,
|
42
|
+
"name": "Adam"
|
43
|
+
},
|
44
|
+
"owner": {
|
45
|
+
"id": 19059,
|
46
|
+
"name": "Adam"
|
47
|
+
}
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"id": 6,
|
51
|
+
"text": "Delete a post",
|
52
|
+
"size": "",
|
53
|
+
"color": "grey",
|
54
|
+
"ready": false,
|
55
|
+
"blocked": false,
|
56
|
+
"phase": {
|
57
|
+
"id": 87565,
|
58
|
+
"name": "Backlog"
|
59
|
+
},
|
60
|
+
"phaseIndex": 3,
|
61
|
+
"creator": {
|
62
|
+
"id": 19059,
|
63
|
+
"name": "Adam"
|
64
|
+
},
|
65
|
+
"owner": {
|
66
|
+
"id": 19059,
|
67
|
+
"name": "Adam"
|
68
|
+
}
|
69
|
+
}
|
70
|
+
]
|
71
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
{
|
2
|
+
"page": 1,
|
3
|
+
"pageSize": 10,
|
4
|
+
"totalPages": 1,
|
5
|
+
"totalItems": 1,
|
6
|
+
"items": {
|
7
|
+
"story": [
|
8
|
+
{
|
9
|
+
"id": 1,
|
10
|
+
"text": "End world hunger",
|
11
|
+
"size": "large",
|
12
|
+
"color": "grey",
|
13
|
+
"ready": false,
|
14
|
+
"blocked": false,
|
15
|
+
"phase": {
|
16
|
+
"id": 1,
|
17
|
+
"name": "Backlog"
|
18
|
+
},
|
19
|
+
"phaseIndex": 0,
|
20
|
+
"creator": {
|
21
|
+
"id": 1,
|
22
|
+
"name": "John Doe"
|
23
|
+
},
|
24
|
+
"owner": {
|
25
|
+
"id": 2,
|
26
|
+
"name": "Jane Doe"
|
27
|
+
}
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"id": 2,
|
31
|
+
"text": "Start world hunger",
|
32
|
+
"size": "large",
|
33
|
+
"color": "grey",
|
34
|
+
"ready": false,
|
35
|
+
"blocked": false,
|
36
|
+
"phase": {
|
37
|
+
"id": 1,
|
38
|
+
"name": "Backlog"
|
39
|
+
},
|
40
|
+
"phaseIndex": 0,
|
41
|
+
"creator": {
|
42
|
+
"id": 3,
|
43
|
+
"name": "Kill Bill"
|
44
|
+
},
|
45
|
+
"owner": {
|
46
|
+
"id": 4,
|
47
|
+
"name": "Dinjas"
|
48
|
+
}
|
49
|
+
}
|
50
|
+
]
|
51
|
+
}
|
52
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
{
|
2
|
+
"id": 321,
|
3
|
+
"text": "Feed the children",
|
4
|
+
"size": "large",
|
5
|
+
"color": "grey",
|
6
|
+
"ready": false,
|
7
|
+
"blocked": true,
|
8
|
+
"reasonBlocked": "Need new ideas",
|
9
|
+
"phase": {
|
10
|
+
"id": 1,
|
11
|
+
"name": "Backlog"
|
12
|
+
},
|
13
|
+
"phaseIndex": 0,
|
14
|
+
"creator": {
|
15
|
+
"id": 1,
|
16
|
+
"name": "John Doe"
|
17
|
+
},
|
18
|
+
"owner": {
|
19
|
+
"id": 2,
|
20
|
+
"name": "Jane Doe"
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
{
|
2
|
+
"id": 2,
|
3
|
+
"text": "User sign in",
|
4
|
+
"details": "The user should be able to sign in with either email or username.",
|
5
|
+
"size": "2",
|
6
|
+
"color": "grey",
|
7
|
+
"ready": false,
|
8
|
+
"blocked": false,
|
9
|
+
"phase": {
|
10
|
+
"id": 87566,
|
11
|
+
"name": "Ready"
|
12
|
+
},
|
13
|
+
"phaseIndex": 0,
|
14
|
+
"creator": {
|
15
|
+
"id": 19059,
|
16
|
+
"name": "Adam"
|
17
|
+
},
|
18
|
+
"owner": {
|
19
|
+
"id": 19059,
|
20
|
+
"name": "Adam"
|
21
|
+
},
|
22
|
+
"tags": [
|
23
|
+
{
|
24
|
+
"id": 81499,
|
25
|
+
"name": "sign-in"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"id": 81500,
|
29
|
+
"name": "user"
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"id": 81501,
|
33
|
+
"name": "authentication"
|
34
|
+
}
|
35
|
+
],
|
36
|
+
"metrics": {
|
37
|
+
"createTime": "/Date(1289217335000-0600)/",
|
38
|
+
"startTime": "/Date(1295607873000-0600)/"
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"id": 2,
|
3
|
+
"text": "User sign in",
|
4
|
+
"size": "2",
|
5
|
+
"color": "grey",
|
6
|
+
"ready": false,
|
7
|
+
"blocked": false,
|
8
|
+
"phase": {
|
9
|
+
"id": 87566,
|
10
|
+
"name": "Ready"
|
11
|
+
},
|
12
|
+
"phaseIndex": 0,
|
13
|
+
"creator": {
|
14
|
+
"id": 19059,
|
15
|
+
"name": "Adam"
|
16
|
+
},
|
17
|
+
"owner": {
|
18
|
+
"id": 19059,
|
19
|
+
"name": "Adam"
|
20
|
+
},
|
21
|
+
"tags": [
|
22
|
+
{
|
23
|
+
"id": 81499,
|
24
|
+
"name": "sign-in"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"id": 81500,
|
28
|
+
"name": "user"
|
29
|
+
},
|
30
|
+
{
|
31
|
+
"id": 81501,
|
32
|
+
"name": "authentication"
|
33
|
+
}
|
34
|
+
]
|
35
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require File.expand_path('../support/fakeweb_helper', __FILE__)
|
3
|
+
|
4
|
+
describe AgileZen::Projects do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@client = AgileZen::Client.new(:api_key => 'testapikey')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#projects" do
|
11
|
+
context "success" do
|
12
|
+
it "performs an API request for all projects" do
|
13
|
+
register_get('http://agilezen.com/api/v1/projects', 'projects.json')
|
14
|
+
|
15
|
+
response = @client.projects
|
16
|
+
|
17
|
+
response.projects.items.project.first.name.should eq('World Peace')
|
18
|
+
end
|
19
|
+
|
20
|
+
it "allows filtering" do
|
21
|
+
register_get('http://agilezen.com/api/v1/projects?where=name%3ADiff', 'projects-with-filtering.json')
|
22
|
+
|
23
|
+
response = @client.projects(:where => 'name:Diff')
|
24
|
+
|
25
|
+
response.items.first.name.should =~ /Diff/i
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#project" do
|
31
|
+
context "success" do
|
32
|
+
it "performs an API request for a single project" do
|
33
|
+
register_get('http://agilezen.com/api/v1/project/123', 'project.json')
|
34
|
+
|
35
|
+
response = @client.project(123)
|
36
|
+
|
37
|
+
response.id.should eq(123)
|
38
|
+
response.name.should eq('Hippie Peace')
|
39
|
+
end
|
40
|
+
|
41
|
+
it "includes enrichments" do
|
42
|
+
register_get('http://agilezen.com/api/v1/project/15404?with=details%2Cphases%2Cmembers%2Croles%2Cinvites%2Cmetrics', 'project/15404-with-enrichments.json')
|
43
|
+
|
44
|
+
response = @client.project(15404, :with => 'details,phases,members,roles,invites,metrics')
|
45
|
+
|
46
|
+
response.details.should_not be_nil
|
47
|
+
response.phases.should_not be_nil
|
48
|
+
response.members.should_not be_nil
|
49
|
+
response.roles.should_not be_nil
|
50
|
+
response.invites.should_not be_nil
|
51
|
+
response.metrics.should_not be_nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "failure" do
|
56
|
+
it "returns nil to indicate failure" do
|
57
|
+
register_get('http://agilezen.com/api/v1/project/99999', 'garbage.txt')
|
58
|
+
|
59
|
+
response = @client.project(99999)
|
60
|
+
|
61
|
+
response.should be_nil
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require File.expand_path('../support/fakeweb_helper', __FILE__)
|
3
|
+
|
4
|
+
describe AgileZen::Stories do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@client = AgileZen::Client.new(:api_key => 'testapikey')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "#stories" do
|
11
|
+
context "success" do
|
12
|
+
it "performs an API request for all story of a given project" do
|
13
|
+
register_get('http://agilezen.com/api/v1/project/123/stories', 'stories.json')
|
14
|
+
|
15
|
+
response = @client.project_stories(123)
|
16
|
+
|
17
|
+
response.items.story.first.text.should eq('End world hunger')
|
18
|
+
end
|
19
|
+
|
20
|
+
it "pages stories" do
|
21
|
+
register_get('http://agilezen.com/api/v1/project/15404/stories?page=1&pageSize=3', 'stories-page1.json')
|
22
|
+
register_get('http://agilezen.com/api/v1/project/15404/stories?page=2&pageSize=3', 'stories-page2.json')
|
23
|
+
|
24
|
+
response1 = @client.project_stories(15404, :page => 1, :pageSize => 3)
|
25
|
+
response2 = @client.project_stories(15404, :page => 2, :pageSize => 3)
|
26
|
+
|
27
|
+
response1.items.should_not eql(response2.items)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
context "failure" do
|
32
|
+
it "returns nil to indicate failure" do
|
33
|
+
register_get('http://agilezen.com/api/v1/project/99999/stories', 'garbage.txt')
|
34
|
+
|
35
|
+
response = @client.project_stories(99999)
|
36
|
+
|
37
|
+
response.should be_nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "#story" do
|
43
|
+
context "success" do
|
44
|
+
it "performs an API request for a single story of a given project" do
|
45
|
+
register_get('http://agilezen.com/api/v1/project/123/story/321', 'story.json')
|
46
|
+
|
47
|
+
response = @client.project_story(123, 321)
|
48
|
+
|
49
|
+
response.id.should eq(321)
|
50
|
+
response.text.should eq('Feed the children')
|
51
|
+
end
|
52
|
+
|
53
|
+
it "includes enrichments" do
|
54
|
+
register_get('http://agilezen.com/api/v1/project/15404/story/2?with=details%2Ctags%2Cmetrics', 'story/2-with-enrichments.json')
|
55
|
+
|
56
|
+
response = @client.project_story(15404, 2, :with => 'details,tags,metrics')
|
57
|
+
|
58
|
+
response.details.should_not be_nil
|
59
|
+
response.tags.should_not be_nil
|
60
|
+
response.metrics.should_not be_nil
|
61
|
+
end
|
62
|
+
|
63
|
+
it "allows filtering" do
|
64
|
+
register_get('http://agilezen.com/api/v1/project/15404/story/2?where=tag%3Aauthentication&with=tags', 'story/2-with-filtering.json')
|
65
|
+
|
66
|
+
response = @client.project_story(15404, 2, :where => 'tag:authentication', :with => 'tags')
|
67
|
+
|
68
|
+
response.id.should == 2
|
69
|
+
response.tags.detect { |t| t.name == 'authentication' }.should_not be_nil
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context "failure" do
|
74
|
+
it "returns nil to indicate failure" do
|
75
|
+
register_get('http://agilezen.com/api/v1/project/99999/story/11111', 'garbage.txt')
|
76
|
+
|
77
|
+
response = @client.project_story(99999, 11111)
|
78
|
+
|
79
|
+
response.should be_nil
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|