pivotal_sync 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -1
- data/README.md +2 -2
- data/lib/pivotal_sync/comment.rb +1 -1
- data/lib/pivotal_sync/iteration.rb +1 -1
- data/lib/pivotal_sync/membership.rb +2 -2
- data/lib/pivotal_sync/project.rb +1 -1
- data/lib/pivotal_sync/story.rb +8 -7
- data/lib/pivotal_sync/version.rb +1 -1
- data/pivotal_sync.gemspec +1 -1
- data/spec/fixtures/attachments.xml +20 -0
- data/spec/fixtures/iterations.xml +5 -7
- data/spec/pivotal_sync/attachment_spec.rb +29 -1
- data/spec/pivotal_sync/comment_spec.rb +26 -0
- data/spec/pivotal_sync/iteration_spec.rb +166 -0
- data/spec/pivotal_sync/membership_spec.rb +19 -0
- data/spec/pivotal_sync/story_spec.rb +7 -3
- data/spec/pivotal_sync/task_spec.rb +20 -0
- metadata +5 -3
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -102,8 +102,8 @@ Gives access to projects, iterations, stories, memberships, attachments, comment
|
|
102
102
|
|
103
103
|
attachment has_one :uploaded_by (Person)
|
104
104
|
comment has_one :author (Person)
|
105
|
-
story has_one :
|
106
|
-
story has_one :
|
105
|
+
story has_one :ownedby (Person)
|
106
|
+
story has_one :requestedby (Person)
|
107
107
|
|
108
108
|
## Installation
|
109
109
|
|
data/lib/pivotal_sync/comment.rb
CHANGED
@@ -2,8 +2,8 @@ module PivotalSync
|
|
2
2
|
class Membership
|
3
3
|
include HappyMapper
|
4
4
|
|
5
|
-
element :id, Integer,
|
6
|
-
element :role, String,
|
5
|
+
element :id, Integer, tag: 'id'
|
6
|
+
element :role, String, tag: 'role'
|
7
7
|
element :user_id, Integer, tag: "id", deep: true
|
8
8
|
element :name, String, deep: true
|
9
9
|
element :email, String, deep: true
|
data/lib/pivotal_sync/project.rb
CHANGED
@@ -36,7 +36,7 @@ module PivotalSync
|
|
36
36
|
element :bugs_and_chores_are_estimatable, Boolean
|
37
37
|
element :commit_mode, Boolean
|
38
38
|
element :last_activity_at, DateTime
|
39
|
-
has_many :memberships, Membership
|
39
|
+
has_many :memberships, Membership, :tag => 'membership'
|
40
40
|
has_many :integrations, Integration
|
41
41
|
|
42
42
|
def iterations
|
data/lib/pivotal_sync/story.rb
CHANGED
@@ -28,18 +28,19 @@ module PivotalSync
|
|
28
28
|
element :updated_at, DateTime
|
29
29
|
element :accepted_at, DateTime
|
30
30
|
element :labels, String
|
31
|
-
has_one :owned_by, Person
|
32
|
-
has_one :requested_by, Person
|
33
|
-
has_many :attachments, Attachment
|
34
|
-
has_many :comments, Comment
|
31
|
+
has_one :owned_by, Person, :tag => 'owned_by'
|
32
|
+
has_one :requested_by, Person, :tag => 'requested_by'
|
33
|
+
has_many :attachments, Attachment, :tag => 'attachment'
|
34
|
+
has_many :comments, Comment, :tag => 'comment'
|
35
|
+
has_many :tasks, Task, :tag => 'task'
|
35
36
|
|
36
37
|
def project
|
37
38
|
Project.find(project_id)
|
38
39
|
end
|
39
40
|
|
40
|
-
def tasks
|
41
|
-
|
42
|
-
end
|
41
|
+
# def tasks
|
42
|
+
# Task.all(project_id, id)
|
43
|
+
# end
|
43
44
|
|
44
45
|
end
|
45
46
|
end
|
data/lib/pivotal_sync/version.rb
CHANGED
data/pivotal_sync.gemspec
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<attachments type="array">
|
3
|
+
<attachment>
|
4
|
+
<id type="integer">17148567</id>
|
5
|
+
<filename>Screen_Shot_2013-03-19_at_12.01.09_PM.png</filename>
|
6
|
+
<uploaded_by>
|
7
|
+
<person>
|
8
|
+
<id type="integer">126384</id>
|
9
|
+
<name>Brandon Hansen</name>
|
10
|
+
<initials>BH</initials>
|
11
|
+
</person>
|
12
|
+
</uploaded_by>
|
13
|
+
<s3_resource>
|
14
|
+
<url>https://s3.amazonaws.com/prod.tracker2/resource/17148567/Screen_Shot_2013-03-19_at_12.01.09_PM.png?AWSAccessKeyId=AKIAIKWOAN6H4H3QMJ6Q&Expires=1363730609&Signature=1pyBFrkP86%2FqfErB%2FlP63H%2Bo41s%3D</url>
|
15
|
+
<expires type="datetime">2013/03/19 22:03:29 UTC</expires>
|
16
|
+
</s3_resource>
|
17
|
+
<uploaded_at type="datetime">2013/03/19 21:25:21 UTC</uploaded_at>
|
18
|
+
<url>https://www.pivotaltracker.com/resource/download/17148567</url>
|
19
|
+
</attachment>
|
20
|
+
</attachments>
|
@@ -14,9 +14,7 @@
|
|
14
14
|
<url>http://www.pivotaltracker.com/story/show/46499703</url>
|
15
15
|
<estimate type="float">1</estimate>
|
16
16
|
<current_state>unstarted</current_state>
|
17
|
-
<description>
|
18
|
-
|
19
|
-
ƒ¬˙∂˚ß∆˙ƒ</description>
|
17
|
+
<description>This is a description</description>
|
20
18
|
<name>Just a little test</name>
|
21
19
|
<requested_by>
|
22
20
|
<person>
|
@@ -27,14 +25,14 @@
|
|
27
25
|
</requested_by>
|
28
26
|
<owned_by>
|
29
27
|
<person>
|
30
|
-
<id type="integer">
|
31
|
-
<name>
|
32
|
-
<initials>
|
28
|
+
<id type="integer">123456</id>
|
29
|
+
<name>Sami Andrew</name>
|
30
|
+
<initials>SA</initials>
|
33
31
|
</person>
|
34
32
|
</owned_by>
|
35
33
|
<created_at type="datetime">2013/03/19 21:25:26 UTC</created_at>
|
36
34
|
<updated_at type="datetime">2013/03/19 21:33:26 UTC</updated_at>
|
37
|
-
<labels>123,testing
|
35
|
+
<labels>123,testing</labels>
|
38
36
|
<comments type="array">
|
39
37
|
<comment>
|
40
38
|
<id type="integer">39331775</id>
|
@@ -1,5 +1,33 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe PivotalSync::Attachment do
|
4
|
-
|
4
|
+
|
5
|
+
before(:each) { @file = File.open("#{RSpec.configuration.fixture_path}attachments.xml", "rb") }
|
6
|
+
after(:each) { @file.close }
|
7
|
+
|
8
|
+
let(:attachments) { PivotalSync::Attachment.parse(@file.read) }
|
9
|
+
|
10
|
+
context "attachments" do
|
11
|
+
subject(:attachment) { attachments.first }
|
12
|
+
|
13
|
+
it "should have many attachments" do
|
14
|
+
attachments.should be_a(Array)
|
15
|
+
attachments.count.should == 1
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have an id" do
|
19
|
+
attachment.id.should == 17148567
|
20
|
+
attachment.filename.should == "Screen_Shot_2013-03-19_at_12.01.09_PM.png"
|
21
|
+
attachment.uploaded_at.to_s.should == "2013-03-19T21:25:21+00:00"
|
22
|
+
attachment.url.should == "https://www.pivotaltracker.com/resource/download/17148567"
|
23
|
+
end
|
24
|
+
|
25
|
+
context "uploaded_by" do
|
26
|
+
subject(:uploaded_by) { attachment.uploaded_by }
|
27
|
+
|
28
|
+
its(:id) { should == 126384 }
|
29
|
+
its(:name) { should == "Brandon Hansen" }
|
30
|
+
its(:initials) { should == "BH" }
|
31
|
+
end
|
32
|
+
end
|
5
33
|
end
|
@@ -1,5 +1,31 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe PivotalSync::Comment do
|
4
|
+
|
5
|
+
before(:each) { @file = File.open("#{RSpec.configuration.fixture_path}comments.xml", "rb") }
|
6
|
+
after(:each) { @file.close }
|
7
|
+
|
8
|
+
let(:comments) { PivotalSync::Comment.parse(@file.read) }
|
9
|
+
|
10
|
+
context "comments" do
|
11
|
+
subject(:comment) { comments.first }
|
12
|
+
|
13
|
+
it "should have many comments" do
|
14
|
+
comments.should be_a(Array)
|
15
|
+
comments.count.should == 2
|
16
|
+
end
|
17
|
+
|
18
|
+
its(:id) { should == 39331775 }
|
19
|
+
its(:text) { should == "Adding some comments here" }
|
20
|
+
its(:created_at) { should == DateTime.parse("2013-03-19T21:25:27+00:00") }
|
21
|
+
|
22
|
+
context "author" do
|
23
|
+
subject(:author) { comment.author }
|
24
|
+
|
25
|
+
its(:id) { should == 126384 }
|
26
|
+
its(:name) { should == "Brandon Hansen" }
|
27
|
+
its(:initials) { should == "BH" }
|
28
|
+
end
|
29
|
+
end
|
4
30
|
|
5
31
|
end
|
@@ -1,5 +1,171 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe PivotalSync::Iteration do
|
4
|
+
|
5
|
+
before(:each) { @file = File.open("#{RSpec.configuration.fixture_path}iterations.xml", "rb") }
|
6
|
+
after(:each) { @file.close }
|
7
|
+
|
8
|
+
let(:iterations) { PivotalSync::Iteration.parse(@file.read) }
|
9
|
+
let(:iteration) { iterations.first }
|
10
|
+
let(:story) { iteration.stories.first }
|
11
|
+
|
12
|
+
context "data" do
|
13
|
+
|
14
|
+
it "should be an array of iterations" do
|
15
|
+
iterations.should be_a(Array)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should have valid data" do
|
19
|
+
iteration.id.should == 1
|
20
|
+
iteration.number.should == 1
|
21
|
+
iteration.start.to_s.should == "2013-03-18T07:00:00+00:00"
|
22
|
+
iteration.finish.to_s.should == "2013-03-25T07:00:00+00:00"
|
23
|
+
iteration.team_strength.should == 1.0
|
24
|
+
iteration.stories.count.should == 1
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
4
28
|
|
29
|
+
context "associations" do
|
30
|
+
|
31
|
+
context "stories" do
|
32
|
+
|
33
|
+
it "should have many stories" do
|
34
|
+
iteration.stories.should be_a(Array)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should have valid data" do
|
38
|
+
story.id.should == 46499703
|
39
|
+
story.project_id.should == 784123
|
40
|
+
story.story_type.should == "feature"
|
41
|
+
story.url.should == "http://www.pivotaltracker.com/story/show/46499703"
|
42
|
+
story.estimate.should == 1.0
|
43
|
+
story.current_state.should == "unstarted"
|
44
|
+
story.description.should == "This is a description"
|
45
|
+
story.name.should == "Just a little test"
|
46
|
+
story.labels.should == "123,testing"
|
47
|
+
story.created_at.to_s.should == "2013-03-19T21:25:26+00:00"
|
48
|
+
story.updated_at.to_s.should == "2013-03-19T21:33:26+00:00"
|
49
|
+
story.accepted_at.should == nil
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
context "owner" do
|
54
|
+
|
55
|
+
let(:owned_by) { story.owned_by }
|
56
|
+
|
57
|
+
it "should belong to a owner" do
|
58
|
+
story.should respond_to(:owned_by)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should be of class person" do
|
62
|
+
owned_by.should be_a(PivotalSync::Person)
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should have an id" do
|
66
|
+
owned_by.id.should == 123456
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should be owned by brandon" do
|
70
|
+
owned_by.name.should == "Sami Andrew"
|
71
|
+
end
|
72
|
+
|
73
|
+
it "should have initials BH" do
|
74
|
+
owned_by.initials.should == "SA"
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
context "requester" do
|
80
|
+
|
81
|
+
let(:requested_by) { story.requested_by }
|
82
|
+
|
83
|
+
it "should belong to a owner" do
|
84
|
+
story.should respond_to(:requested_by)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should be of class person" do
|
88
|
+
requested_by.should be_a(PivotalSync::Person)
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should have an id" do
|
92
|
+
requested_by.id.should == 126384
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should be requested by brandon" do
|
96
|
+
requested_by.name.should == "Brandon Hansen"
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should have initials BH" do
|
100
|
+
requested_by.initials.should == "BH"
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
context "attachments" do
|
106
|
+
|
107
|
+
let(:attachment) { story.attachments.first }
|
108
|
+
|
109
|
+
it "should have many attachments" do
|
110
|
+
story.attachments.should be_a(Array)
|
111
|
+
story.attachments.count.should == 1
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should have an id" do
|
115
|
+
attachment.id.should == 17148567
|
116
|
+
attachment.filename.should == "Screen_Shot_2013-03-19_at_12.01.09_PM.png"
|
117
|
+
attachment.uploaded_at.to_s.should == "2013-03-19T21:25:21+00:00"
|
118
|
+
attachment.url.should == "https://www.pivotaltracker.com/resource/download/17148567"
|
119
|
+
end
|
120
|
+
|
121
|
+
context "uploaded_by" do
|
122
|
+
subject(:uploaded_by) { attachment.uploaded_by }
|
123
|
+
|
124
|
+
its(:id) { should == 126384 }
|
125
|
+
its(:name) { should == "Brandon Hansen" }
|
126
|
+
its(:initials) { should == "BH" }
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
context "comments" do
|
132
|
+
subject(:comment) { story.comments.first }
|
133
|
+
|
134
|
+
it "should have many comments" do
|
135
|
+
story.comments.should be_a(Array)
|
136
|
+
story.comments.count.should == 2
|
137
|
+
end
|
138
|
+
|
139
|
+
its(:id) { should == 39331775 }
|
140
|
+
its(:text) { should == "Adding some comments here" }
|
141
|
+
its(:created_at) { should == DateTime.parse("2013-03-19T21:25:27+00:00") }
|
142
|
+
|
143
|
+
context "author" do
|
144
|
+
subject(:author) { comment.author }
|
145
|
+
|
146
|
+
its(:id) { should == 126384 }
|
147
|
+
its(:name) { should == "Brandon Hansen" }
|
148
|
+
its(:initials) { should == "BH" }
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
context "tasks" do
|
153
|
+
subject(:task) { story.tasks.first }
|
154
|
+
|
155
|
+
it "should have many tasks" do
|
156
|
+
story.tasks.should be_a(Array)
|
157
|
+
story.tasks.count.should == 3
|
158
|
+
end
|
159
|
+
|
160
|
+
its(:id) { should == 13346287 }
|
161
|
+
its(:description) { should == "Get" }
|
162
|
+
its(:position) { should == 1 }
|
163
|
+
its(:complete) { should == false }
|
164
|
+
its(:created_at) { should == DateTime.parse("2013-03-19T21:25:27+00:00") }
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
|
169
|
+
end
|
170
|
+
|
5
171
|
end
|
@@ -2,4 +2,23 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe PivotalSync::Membership do
|
4
4
|
|
5
|
+
before(:each) { @file = File.open("#{RSpec.configuration.fixture_path}memberships.xml", "rb") }
|
6
|
+
after(:each) { @file.close }
|
7
|
+
|
8
|
+
let(:memberships) { PivotalSync::Membership.parse(@file.read) }
|
9
|
+
|
10
|
+
context "memberships" do
|
11
|
+
subject(:membership) { memberships.first }
|
12
|
+
|
13
|
+
it "should have many memberships" do
|
14
|
+
memberships.should be_a(Array)
|
15
|
+
memberships.count.should == 1
|
16
|
+
end
|
17
|
+
|
18
|
+
its(:id) { should == 2930385 }
|
19
|
+
its(:role) { should == "Owner" }
|
20
|
+
its(:name) { should == "Brandon Hansen" }
|
21
|
+
its(:initials) { should == "BH" }
|
22
|
+
its(:email) { should == nil }
|
23
|
+
end
|
5
24
|
end
|
@@ -18,6 +18,10 @@ describe PivotalSync::Story do
|
|
18
18
|
story.id.should_not be_nil
|
19
19
|
end
|
20
20
|
|
21
|
+
it "should have name" do
|
22
|
+
story.name.should_not be_nil
|
23
|
+
end
|
24
|
+
|
21
25
|
it "should have labels" do
|
22
26
|
story.labels.should_not be_nil
|
23
27
|
end
|
@@ -68,11 +72,11 @@ describe PivotalSync::Story do
|
|
68
72
|
requested_by.id.should == 1233535
|
69
73
|
end
|
70
74
|
|
71
|
-
it "should be requested by
|
75
|
+
it "should be requested by Chris" do
|
72
76
|
requested_by.name.should == "Chris Gratigny"
|
73
77
|
end
|
74
78
|
|
75
|
-
it "should have initials
|
79
|
+
it "should have initials CG" do
|
76
80
|
requested_by.initials.should == "CG"
|
77
81
|
end
|
78
82
|
|
@@ -81,7 +85,7 @@ describe PivotalSync::Story do
|
|
81
85
|
context "attachments" do
|
82
86
|
|
83
87
|
it "should have many attachments" do
|
84
|
-
story.
|
88
|
+
story.attachments.should be_a(Array)
|
85
89
|
end
|
86
90
|
|
87
91
|
end
|
@@ -2,4 +2,24 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe PivotalSync::Task do
|
4
4
|
|
5
|
+
before(:each) { @file = File.open("#{RSpec.configuration.fixture_path}tasks.xml", "rb") }
|
6
|
+
after(:each) { @file.close }
|
7
|
+
|
8
|
+
let(:tasks) { PivotalSync::Task.parse(@file.read) }
|
9
|
+
|
10
|
+
context "tasks" do
|
11
|
+
subject(:task) { tasks.first }
|
12
|
+
|
13
|
+
it "should have many tasks" do
|
14
|
+
tasks.should be_a(Array)
|
15
|
+
tasks.count.should == 3
|
16
|
+
end
|
17
|
+
|
18
|
+
its(:id) { should == 13346287 }
|
19
|
+
its(:description) { should == "Get" }
|
20
|
+
its(:position) { should == 1 }
|
21
|
+
its(:complete) { should == false }
|
22
|
+
its(:created_at) { should == DateTime.parse("2013-03-19T21:25:27+00:00") }
|
23
|
+
end
|
24
|
+
|
5
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pivotal_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name: happymapper
|
63
|
+
name: nokogiri-happymapper
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- lib/pivotal_sync/task.rb
|
102
102
|
- lib/pivotal_sync/version.rb
|
103
103
|
- pivotal_sync.gemspec
|
104
|
+
- spec/fixtures/attachments.xml
|
104
105
|
- spec/fixtures/comments.xml
|
105
106
|
- spec/fixtures/iterations.xml
|
106
107
|
- spec/fixtures/memberships.xml
|
@@ -144,6 +145,7 @@ signing_key:
|
|
144
145
|
specification_version: 3
|
145
146
|
summary: Read from the Pivotal Tracker v4 api
|
146
147
|
test_files:
|
148
|
+
- spec/fixtures/attachments.xml
|
147
149
|
- spec/fixtures/comments.xml
|
148
150
|
- spec/fixtures/iterations.xml
|
149
151
|
- spec/fixtures/memberships.xml
|