peaty 0.4.7 → 0.4.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.textile +14 -0
- data/VERSION +1 -1
- data/lib/peaty/story.rb +27 -0
- data/peaty.gemspec +5 -3
- data/test/fixtures/move_after.xml +13 -0
- data/test/fixtures/move_before.xml +14 -0
- data/test/peaty_test.rb +34 -0
- data/test/test_helper.rb +2 -1
- metadata +54 -110
data/Readme.textile
CHANGED
@@ -31,6 +31,20 @@ end
|
|
31
31
|
|
32
32
|
See how current API works for selecting types of stories (chores, bugs, releases, and features)
|
33
33
|
|
34
|
+
h3. Moving Stories
|
35
|
+
|
36
|
+
<pre>
|
37
|
+
project = u.pt_projects.first
|
38
|
+
stories = project.stories.all
|
39
|
+
story1, story2 = stories[0], stories[1]
|
40
|
+
|
41
|
+
# moves story1 before story2
|
42
|
+
story1.move(:before => story2)
|
43
|
+
|
44
|
+
# moves story2 after story 1
|
45
|
+
story2.move(:after => story1)
|
46
|
+
</pre>
|
47
|
+
|
34
48
|
h2. Contributing
|
35
49
|
|
36
50
|
Step 1: Submit a failing test.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.8
|
data/lib/peaty/story.rb
CHANGED
@@ -15,6 +15,30 @@ module Peaty
|
|
15
15
|
def project
|
16
16
|
Project.with_connection(self.class.connection).find(self.project_id)
|
17
17
|
end
|
18
|
+
|
19
|
+
# Moves a story before or after another story
|
20
|
+
#
|
21
|
+
# story1.move(:before => story2)
|
22
|
+
# story2.move(:after => story1)
|
23
|
+
def move(options)
|
24
|
+
@error = nil
|
25
|
+
|
26
|
+
move_options = { :project_id => project_id }
|
27
|
+
if options[:before]
|
28
|
+
move_options.merge!({ :type => :before, :target_id => options[:before].id })
|
29
|
+
elsif options[:after]
|
30
|
+
move_options.merge!({ :type => :after, :target_id => options[:after].id })
|
31
|
+
else
|
32
|
+
raise ArgumentError, "Must specify :before => story or :after => story"
|
33
|
+
end
|
34
|
+
|
35
|
+
self.connection[self.class.move_path(id, move_options)].post("").body
|
36
|
+
|
37
|
+
self
|
38
|
+
rescue RestClient::UnprocessableEntity => e
|
39
|
+
@error = JSON.parse(XmlToJson.transform(e.response.body))["message"]
|
40
|
+
false
|
41
|
+
end
|
18
42
|
|
19
43
|
class << self
|
20
44
|
def element
|
@@ -26,6 +50,9 @@ module Peaty
|
|
26
50
|
def member_path(id, options = {})
|
27
51
|
"/projects/%i/stories/%i" % [options[:project_id].to_i, id]
|
28
52
|
end
|
53
|
+
def move_path(id, options = {})
|
54
|
+
"/projects/%i/stories/%i/moves?move[move]=%s&move[target]=%i" % [options[:project_id].to_i, id, options[:type], options[:target_id].to_i]
|
55
|
+
end
|
29
56
|
|
30
57
|
### Filters
|
31
58
|
|
data/peaty.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{peaty}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matt Todd"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-06-01}
|
13
13
|
s.description = %q{Just another Pivotal Tracker API Implementation}
|
14
14
|
s.email = %q{chiology@gmail.com}
|
15
15
|
s.files = [
|
@@ -35,6 +35,8 @@ Gem::Specification.new do |s|
|
|
35
35
|
"test/fixtures/features.xml",
|
36
36
|
"test/fixtures/iterations.xml",
|
37
37
|
"test/fixtures/iterations_done.xml",
|
38
|
+
"test/fixtures/move_after.xml",
|
39
|
+
"test/fixtures/move_before.xml",
|
38
40
|
"test/fixtures/project.xml",
|
39
41
|
"test/fixtures/projects.xml",
|
40
42
|
"test/fixtures/release.xml",
|
@@ -48,7 +50,7 @@ Gem::Specification.new do |s|
|
|
48
50
|
s.homepage = %q{http://github.com/mtodd/peaty}
|
49
51
|
s.licenses = ["MIT"]
|
50
52
|
s.require_paths = ["lib"]
|
51
|
-
s.rubygems_version = %q{1.
|
53
|
+
s.rubygems_version = %q{1.6.2}
|
52
54
|
s.summary = %q{Pivotal Tracker API Implementation}
|
53
55
|
s.test_files = [
|
54
56
|
"test/peaty_test.rb",
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<story>
|
3
|
+
<id type="integer">6822209</id>
|
4
|
+
<project_id type="integer">153937</project_id>
|
5
|
+
<story_type>chore</story_type>
|
6
|
+
<url>http://www.pivotaltracker.com/story/show/6822209</url>
|
7
|
+
<current_state>unstarted</current_state>
|
8
|
+
<description></description>
|
9
|
+
<name>Stuff needs to be defined</name>
|
10
|
+
<requested_by>Matt Todd</requested_by>
|
11
|
+
<created_at type="datetime">2010/11/29 01:39:41 EST</created_at>
|
12
|
+
<updated_at type="datetime">2010/11/29 01:39:45 EST</updated_at>
|
13
|
+
</story>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<story>
|
3
|
+
<id type="integer">6821125</id>
|
4
|
+
<project_id type="integer">153937</project_id>
|
5
|
+
<story_type>feature</story_type>
|
6
|
+
<url>http://www.pivotaltracker.com/story/show/6821125</url>
|
7
|
+
<estimate type="integer">0</estimate>
|
8
|
+
<current_state>unstarted</current_state>
|
9
|
+
<description></description>
|
10
|
+
<name>Stuff can be done</name>
|
11
|
+
<requested_by>Matt Todd</requested_by>
|
12
|
+
<created_at type="datetime">2010/11/29 00:30:39 EST</created_at>
|
13
|
+
<updated_at type="datetime">2010/11/29 00:31:12 EST</updated_at>
|
14
|
+
</story>
|
data/test/peaty_test.rb
CHANGED
@@ -62,6 +62,40 @@ class PeatyTest < Test::Unit::TestCase
|
|
62
62
|
done = project.iterations.find(:done)
|
63
63
|
assert done.stories.any?{ |s| s.id == story.id }
|
64
64
|
end
|
65
|
+
|
66
|
+
def test_user_can_move_stories_after_other_stories
|
67
|
+
project = @user.pivotal_tracker_projects.find(PROJECT_ID)
|
68
|
+
stories = project.stories.all
|
69
|
+
|
70
|
+
story1, story2 = stories[0], stories[1]
|
71
|
+
|
72
|
+
moves_path = "/projects/#{PROJECT_ID}/stories/#{story1.id}/moves?move\[move\]=after&move\[target\]=#{story2.id}"
|
73
|
+
FakeWeb.register_uri(:post,
|
74
|
+
PT_BASE_URI + moves_path,
|
75
|
+
:body => File.read(File.join(File.dirname(__FILE__), "fixtures", "move_after.xml")))
|
76
|
+
|
77
|
+
story1.move(:after => story2)
|
78
|
+
|
79
|
+
assert_equal 'POST', FakeWeb.last_request.method
|
80
|
+
assert_equal PT_BASE_PATH + moves_path, FakeWeb.last_request.path
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_user_can_move_stories_before_other_stories
|
84
|
+
project = @user.pivotal_tracker_projects.find(PROJECT_ID)
|
85
|
+
stories = project.stories.all
|
86
|
+
|
87
|
+
story1, story2 = stories[0], stories[1]
|
88
|
+
|
89
|
+
moves_path = "/projects/#{PROJECT_ID}/stories/#{story2.id}/moves?move\[move\]=before&move\[target\]=#{story1.id}"
|
90
|
+
FakeWeb.register_uri(:post,
|
91
|
+
PT_BASE_URI + moves_path,
|
92
|
+
:body => File.read(File.join(File.dirname(__FILE__), "fixtures", "move_before.xml")))
|
93
|
+
|
94
|
+
story2.move(:before => story1)
|
95
|
+
|
96
|
+
assert_equal 'POST', FakeWeb.last_request.method
|
97
|
+
assert_equal PT_BASE_PATH + moves_path, FakeWeb.last_request.path
|
98
|
+
end
|
65
99
|
|
66
100
|
def test_user_can_fetch_all_releases_for_a_project_via_stories
|
67
101
|
assert !@user.pivotal_tracker_projects.find(PROJECT_ID).stories(:type => :release).all.empty?
|
data/test/test_helper.rb
CHANGED
@@ -16,7 +16,8 @@ PROJECT_ID = 153937
|
|
16
16
|
STORY_ID = 6821071
|
17
17
|
RELEASE_ID = 6821121
|
18
18
|
|
19
|
-
|
19
|
+
PT_BASE_PATH = "/services/v3"
|
20
|
+
PT_BASE_URI = "https://www.pivotaltracker.com" + PT_BASE_PATH
|
20
21
|
{ "/projects" => "projects",
|
21
22
|
"/projects/#{PROJECT_ID}" => "project",
|
22
23
|
"/projects/#{PROJECT_ID}/stories" => "stories",
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: peaty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 1
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
- 7
|
10
|
-
version: 0.4.7
|
5
|
+
version: 0.4.8
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Matt Todd
|
@@ -15,191 +10,141 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
13
|
+
date: 2011-06-01 00:00:00 -04:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
22
|
-
prerelease: false
|
23
17
|
name: activesupport
|
24
|
-
|
25
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
18
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
19
|
none: false
|
27
20
|
requirements:
|
28
21
|
- - ~>
|
29
22
|
- !ruby/object:Gem::Version
|
30
|
-
hash: 15
|
31
|
-
segments:
|
32
|
-
- 3
|
33
|
-
- 0
|
34
|
-
- 4
|
35
23
|
version: 3.0.4
|
36
|
-
|
37
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
type: :runtime
|
38
25
|
prerelease: false
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
39
28
|
name: i18n
|
40
|
-
|
41
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
29
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
30
|
none: false
|
43
31
|
requirements:
|
44
32
|
- - ~>
|
45
33
|
- !ruby/object:Gem::Version
|
46
|
-
hash: 13
|
47
|
-
segments:
|
48
|
-
- 0
|
49
|
-
- 4
|
50
|
-
- 1
|
51
34
|
version: 0.4.1
|
52
|
-
|
53
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
type: :runtime
|
54
36
|
prerelease: false
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
55
39
|
name: nokogiri
|
56
|
-
|
57
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
40
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
58
41
|
none: false
|
59
42
|
requirements:
|
60
43
|
- - ">="
|
61
44
|
- !ruby/object:Gem::Version
|
62
|
-
hash: 3
|
63
|
-
segments:
|
64
|
-
- 0
|
65
45
|
version: "0"
|
66
|
-
|
67
|
-
- !ruby/object:Gem::Dependency
|
46
|
+
type: :runtime
|
68
47
|
prerelease: false
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
69
50
|
name: nokogiri-happymapper
|
70
|
-
|
71
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
51
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
52
|
none: false
|
73
53
|
requirements:
|
74
54
|
- - ">="
|
75
55
|
- !ruby/object:Gem::Version
|
76
|
-
hash: 3
|
77
|
-
segments:
|
78
|
-
- 0
|
79
56
|
version: "0"
|
80
|
-
|
81
|
-
- !ruby/object:Gem::Dependency
|
57
|
+
type: :runtime
|
82
58
|
prerelease: false
|
59
|
+
version_requirements: *id004
|
60
|
+
- !ruby/object:Gem::Dependency
|
83
61
|
name: rest-client
|
84
|
-
|
85
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
62
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
86
63
|
none: false
|
87
64
|
requirements:
|
88
65
|
- - ">="
|
89
66
|
- !ruby/object:Gem::Version
|
90
|
-
hash: 3
|
91
|
-
segments:
|
92
|
-
- 0
|
93
67
|
version: "0"
|
94
|
-
|
95
|
-
- !ruby/object:Gem::Dependency
|
68
|
+
type: :runtime
|
96
69
|
prerelease: false
|
70
|
+
version_requirements: *id005
|
71
|
+
- !ruby/object:Gem::Dependency
|
97
72
|
name: xml_to_json
|
98
|
-
|
99
|
-
version_requirements: &id006 !ruby/object:Gem::Requirement
|
73
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
100
74
|
none: false
|
101
75
|
requirements:
|
102
76
|
- - ~>
|
103
77
|
- !ruby/object:Gem::Version
|
104
|
-
hash: 27
|
105
|
-
segments:
|
106
|
-
- 0
|
107
|
-
- 0
|
108
|
-
- 2
|
109
78
|
version: 0.0.2
|
110
|
-
|
111
|
-
- !ruby/object:Gem::Dependency
|
79
|
+
type: :runtime
|
112
80
|
prerelease: false
|
81
|
+
version_requirements: *id006
|
82
|
+
- !ruby/object:Gem::Dependency
|
113
83
|
name: yajl-ruby
|
114
|
-
|
115
|
-
version_requirements: &id007 !ruby/object:Gem::Requirement
|
84
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
116
85
|
none: false
|
117
86
|
requirements:
|
118
87
|
- - ">="
|
119
88
|
- !ruby/object:Gem::Version
|
120
|
-
hash: 3
|
121
|
-
segments:
|
122
|
-
- 0
|
123
89
|
version: "0"
|
124
|
-
|
125
|
-
- !ruby/object:Gem::Dependency
|
90
|
+
type: :runtime
|
126
91
|
prerelease: false
|
92
|
+
version_requirements: *id007
|
93
|
+
- !ruby/object:Gem::Dependency
|
127
94
|
name: builder
|
128
|
-
|
129
|
-
version_requirements: &id008 !ruby/object:Gem::Requirement
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
130
96
|
none: false
|
131
97
|
requirements:
|
132
98
|
- - ">="
|
133
99
|
- !ruby/object:Gem::Version
|
134
|
-
hash: 3
|
135
|
-
segments:
|
136
|
-
- 0
|
137
100
|
version: "0"
|
138
|
-
|
139
|
-
- !ruby/object:Gem::Dependency
|
101
|
+
type: :development
|
140
102
|
prerelease: false
|
103
|
+
version_requirements: *id008
|
104
|
+
- !ruby/object:Gem::Dependency
|
141
105
|
name: rspec
|
142
|
-
|
143
|
-
version_requirements: &id009 !ruby/object:Gem::Requirement
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
144
107
|
none: false
|
145
108
|
requirements:
|
146
109
|
- - "="
|
147
110
|
- !ruby/object:Gem::Version
|
148
|
-
hash: 11
|
149
|
-
segments:
|
150
|
-
- 2
|
151
|
-
- 1
|
152
|
-
- 0
|
153
111
|
version: 2.1.0
|
154
|
-
|
155
|
-
- !ruby/object:Gem::Dependency
|
112
|
+
type: :development
|
156
113
|
prerelease: false
|
114
|
+
version_requirements: *id009
|
115
|
+
- !ruby/object:Gem::Dependency
|
157
116
|
name: bundler
|
158
|
-
|
159
|
-
version_requirements: &id010 !ruby/object:Gem::Requirement
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
160
118
|
none: false
|
161
119
|
requirements:
|
162
120
|
- - ~>
|
163
121
|
- !ruby/object:Gem::Version
|
164
|
-
hash: 23
|
165
|
-
segments:
|
166
|
-
- 1
|
167
|
-
- 0
|
168
|
-
- 0
|
169
122
|
version: 1.0.0
|
170
|
-
|
171
|
-
- !ruby/object:Gem::Dependency
|
123
|
+
type: :development
|
172
124
|
prerelease: false
|
125
|
+
version_requirements: *id010
|
126
|
+
- !ruby/object:Gem::Dependency
|
173
127
|
name: jeweler
|
174
|
-
|
175
|
-
version_requirements: &id011 !ruby/object:Gem::Requirement
|
128
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
176
129
|
none: false
|
177
130
|
requirements:
|
178
131
|
- - ~>
|
179
132
|
- !ruby/object:Gem::Version
|
180
|
-
hash: 1923832021
|
181
|
-
segments:
|
182
|
-
- 1
|
183
|
-
- 5
|
184
|
-
- 0
|
185
|
-
- pre
|
186
|
-
- 6
|
187
133
|
version: 1.5.0.pre6
|
188
|
-
|
189
|
-
- !ruby/object:Gem::Dependency
|
134
|
+
type: :development
|
190
135
|
prerelease: false
|
136
|
+
version_requirements: *id011
|
137
|
+
- !ruby/object:Gem::Dependency
|
191
138
|
name: rails_code_qa
|
192
|
-
|
193
|
-
version_requirements: &id012 !ruby/object:Gem::Requirement
|
139
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
194
140
|
none: false
|
195
141
|
requirements:
|
196
142
|
- - ">="
|
197
143
|
- !ruby/object:Gem::Version
|
198
|
-
hash: 3
|
199
|
-
segments:
|
200
|
-
- 0
|
201
144
|
version: "0"
|
202
|
-
|
145
|
+
type: :development
|
146
|
+
prerelease: false
|
147
|
+
version_requirements: *id012
|
203
148
|
description: Just another Pivotal Tracker API Implementation
|
204
149
|
email: chiology@gmail.com
|
205
150
|
executables: []
|
@@ -231,6 +176,8 @@ files:
|
|
231
176
|
- test/fixtures/features.xml
|
232
177
|
- test/fixtures/iterations.xml
|
233
178
|
- test/fixtures/iterations_done.xml
|
179
|
+
- test/fixtures/move_after.xml
|
180
|
+
- test/fixtures/move_before.xml
|
234
181
|
- test/fixtures/project.xml
|
235
182
|
- test/fixtures/projects.xml
|
236
183
|
- test/fixtures/release.xml
|
@@ -254,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
254
201
|
requirements:
|
255
202
|
- - ">="
|
256
203
|
- !ruby/object:Gem::Version
|
257
|
-
hash:
|
204
|
+
hash: -2397564694147189909
|
258
205
|
segments:
|
259
206
|
- 0
|
260
207
|
version: "0"
|
@@ -263,14 +210,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
263
210
|
requirements:
|
264
211
|
- - ">="
|
265
212
|
- !ruby/object:Gem::Version
|
266
|
-
hash: 3
|
267
|
-
segments:
|
268
|
-
- 0
|
269
213
|
version: "0"
|
270
214
|
requirements: []
|
271
215
|
|
272
216
|
rubyforge_project:
|
273
|
-
rubygems_version: 1.
|
217
|
+
rubygems_version: 1.6.2
|
274
218
|
signing_key:
|
275
219
|
specification_version: 3
|
276
220
|
summary: Pivotal Tracker API Implementation
|