tracker_api 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/README.md +6 -0
- data/lib/tracker_api.rb +3 -2
- data/lib/tracker_api/client.rb +1 -1
- data/lib/tracker_api/version.rb +1 -1
- data/test/story_test.rb +78 -63
- data/test/vcr/cassettes/get_story_comments.json +1 -0
- data/tracker_api.gemspec +1 -2
- metadata +7 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4ea13ce0c74d3e644ebc7425d5100931b0e1e3a
|
4
|
+
data.tar.gz: 4e5e624540678a7a39757ce74b102e3300dbce8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9356f13e4620b8a7c420b52a2beba5bbd29ef6a921882df0edc0e612d8b77886869a964a1a723fc6b4bc8d73d0eb9f74a0dafd0737f54b40dec8cc3d9a816abe
|
7
|
+
data.tar.gz: 199de08b674ddd887ece1a3f8d30e8be802723185554f70fdacc9dc74c3031c1fd3963b4beaa2c44ad7f61fc685e8f2f6d33874c6b24b90b65baa8bfc211e1e8
|
data/.travis.yml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- "1.9.3"
|
3
|
+
# - "1.9.3"
|
4
4
|
- "2.0.0"
|
5
5
|
- "2.1.0"
|
6
|
-
- "2.2.
|
6
|
+
- "2.2.3"
|
7
7
|
# Faraday::ConnectionFailed: Could not generate DH keypair (Java::JavaLang::RuntimeException)
|
8
8
|
# http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7044060
|
9
|
-
|
9
|
+
- "jruby"
|
10
10
|
# - rbx
|
11
11
|
# - "1.8.7"
|
12
12
|
# uncomment this line if your project needs to run something other than `rake`:
|
data/README.md
CHANGED
@@ -56,6 +56,12 @@ story.attributes = { name: 'Save the Ewoks', description: '...' } # Upda
|
|
56
56
|
story.labels << TrackerApi::Resources::Label.new(name: 'Endor') # Add a new label to an existing story
|
57
57
|
story.save # Save changes made to a story
|
58
58
|
|
59
|
+
story = TrackerApi::Resources::Story.new( client: client,
|
60
|
+
project_id: 123456,
|
61
|
+
id: 847762630) # Use the Story resource to get the story
|
62
|
+
comments = story.comments # comments without first fetching the story.
|
63
|
+
|
64
|
+
|
59
65
|
epics = project.epics # Get all epics for a project
|
60
66
|
epic = epics.first
|
61
67
|
label = epic.label # Get an epic's label
|
data/lib/tracker_api.rb
CHANGED
@@ -11,14 +11,15 @@ else
|
|
11
11
|
end
|
12
12
|
require 'equalizer'
|
13
13
|
require 'representable/json'
|
14
|
-
require '
|
14
|
+
require 'multi_json'
|
15
15
|
|
16
16
|
# stdlib
|
17
17
|
require 'addressable/uri'
|
18
18
|
require 'forwardable'
|
19
19
|
require 'logger'
|
20
20
|
|
21
|
-
|
21
|
+
MultiJson.load_options = {:mode => :compat}
|
22
|
+
MultiJson.dump_options = {:mode => :compat}
|
22
23
|
|
23
24
|
module TrackerApi
|
24
25
|
autoload :Error, 'tracker_api/error'
|
data/lib/tracker_api/client.rb
CHANGED
data/lib/tracker_api/version.rb
CHANGED
data/test/story_test.rb
CHANGED
@@ -84,95 +84,110 @@ describe TrackerApi::Resources::Story do
|
|
84
84
|
owner.must_be_instance_of TrackerApi::Resources::Person
|
85
85
|
end
|
86
86
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
87
|
+
it 'gets all owners for this story' do
|
88
|
+
VCR.use_cassette('get story', record: :new_episodes) do
|
89
|
+
story = project.story(story_id)
|
90
|
+
owners = VCR.use_cassette('get owners for story') { story.owners }
|
91
|
+
|
92
|
+
owners.wont_be_empty
|
93
|
+
owner = owners.first
|
94
|
+
owner.must_be_instance_of TrackerApi::Resources::Person
|
95
|
+
end
|
95
96
|
end
|
96
97
|
end
|
97
|
-
end
|
98
98
|
|
99
|
-
describe '.tasks' do
|
100
|
-
|
101
|
-
|
102
|
-
|
99
|
+
describe '.tasks' do
|
100
|
+
it 'gets all tasks for this story with eager loading' do
|
101
|
+
VCR.use_cassette('get story with tasks', record: :new_episodes) do
|
102
|
+
tasks = project.story(story_id, fields: ':default,tasks').tasks
|
103
103
|
|
104
|
-
|
105
|
-
|
106
|
-
|
104
|
+
tasks.wont_be_empty
|
105
|
+
task = tasks.first
|
106
|
+
task.must_be_instance_of TrackerApi::Resources::Task
|
107
|
+
end
|
107
108
|
end
|
108
|
-
end
|
109
109
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
110
|
+
it 'gets all tasks for this story' do
|
111
|
+
VCR.use_cassette('get tasks', record: :new_episodes) do
|
112
|
+
story = project.story(story_id)
|
113
|
+
tasks = VCR.use_cassette('get tasks for story') { story.tasks }
|
114
114
|
|
115
|
-
|
116
|
-
|
117
|
-
|
115
|
+
tasks.wont_be_empty
|
116
|
+
task = tasks.first
|
117
|
+
task.must_be_instance_of TrackerApi::Resources::Task
|
118
|
+
end
|
118
119
|
end
|
119
|
-
end
|
120
120
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
121
|
+
it 'gets all tasks even when the project_id is excluded from the story fields' do
|
122
|
+
VCR.use_cassette('get tasks when stories filtered', record: :new_episodes) do
|
123
|
+
stories = project.stories(with_state: 'unstarted', fields: 'name,story_type')
|
124
|
+
stories.each do |story|
|
125
|
+
tasks = story.tasks
|
126
|
+
unless tasks.empty?
|
127
|
+
task = tasks.first
|
128
|
+
task.must_be_instance_of TrackerApi::Resources::Task
|
129
|
+
end
|
129
130
|
end
|
130
131
|
end
|
131
132
|
end
|
132
|
-
end
|
133
133
|
|
134
|
-
|
135
|
-
|
136
|
-
|
134
|
+
it 'can create task' do
|
135
|
+
VCR.use_cassette('create task') do
|
136
|
+
task = project.story(story_id).create_task(description: 'Test task')
|
137
137
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
138
|
+
task.must_be_instance_of TrackerApi::Resources::Task
|
139
|
+
task.id.wont_be_nil
|
140
|
+
task.id.must_be :>, 0
|
141
|
+
task.description.must_equal 'Test task'
|
142
|
+
end
|
142
143
|
end
|
143
144
|
end
|
144
|
-
end
|
145
145
|
|
146
|
-
describe '.activity' do
|
147
|
-
|
148
|
-
|
149
|
-
|
146
|
+
describe '.activity' do
|
147
|
+
before do
|
148
|
+
# create some activity
|
149
|
+
story.name = "#{story.name}+"
|
150
150
|
|
151
|
-
|
152
|
-
|
151
|
+
VCR.use_cassette('update story to create activity', record: :new_episodes) do
|
152
|
+
story.save
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
it 'gets all the activity for this story' do
|
157
|
+
VCR.use_cassette('get story activity', record: :new_episodes) do
|
158
|
+
activity = story.activity
|
159
|
+
|
160
|
+
activity.wont_be_empty
|
161
|
+
event = activity.first
|
162
|
+
event.must_be_instance_of TrackerApi::Resources::Activity
|
163
|
+
end
|
153
164
|
end
|
154
165
|
end
|
155
166
|
|
156
|
-
|
157
|
-
|
158
|
-
|
167
|
+
describe '.owners' do
|
168
|
+
it 'gets all owners of this story' do
|
169
|
+
VCR.use_cassette('get story owners', record: :new_episodes) do
|
170
|
+
owners = story.owners
|
159
171
|
|
160
|
-
|
161
|
-
|
162
|
-
|
172
|
+
owners.wont_be_empty
|
173
|
+
owner = owners.first
|
174
|
+
owner.must_be_instance_of TrackerApi::Resources::Person
|
175
|
+
end
|
163
176
|
end
|
164
177
|
end
|
165
|
-
end
|
166
178
|
|
167
|
-
describe '.
|
168
|
-
|
169
|
-
|
170
|
-
|
179
|
+
describe '.comments' do
|
180
|
+
it 'gets all comments of story with just project_id and story_id' do
|
181
|
+
VCR.use_cassette('get story comments', record: :new_episodes) do
|
182
|
+
story = TrackerApi::Resources::Story.new( client: client,
|
183
|
+
project_id: project_id,
|
184
|
+
id: story_id)
|
171
185
|
|
172
|
-
|
173
|
-
|
174
|
-
|
186
|
+
comments = story.comments
|
187
|
+
comment = comments.first
|
188
|
+
comment.must_be_instance_of TrackerApi::Resources::Comment
|
189
|
+
end
|
175
190
|
end
|
176
191
|
end
|
177
|
-
|
192
|
+
|
178
193
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"https://www.pivotaltracker.com/services/v5/projects/1027488/stories/66728004/comments","body":{"encoding":"US-ASCII","string":""},"headers":{"User-Agent":["Ruby/2.2.3 (x86_64-darwin15; ruby) TrackerApi/0.2.11 Faraday/0.9.1"],"X-TrackerToken":["d55c3bc1f74346b843ca84ba340b29bf"]}},"response":{"status":{"code":200,"message":null},"headers":{"Content-Type":["application/json; charset=utf-8"],"Status":["200 OK"],"Cache-Control":["max-age=0, private, must-revalidate"],"Date":["Thu, 17 Dec 2015 22:19:11 GMT"],"X-Tracker-Project-Version":["80"],"X-Request-Id":["bf8de15dbe8dce11ab420e0d988e107f"],"X-UA-Compatible":["IE=Edge,chrome=1"],"ETag":["\"0deb8dbe1ce2f0d1f95892eb3114789a\""],"X-Runtime":["0.066911"],"X-Rack-Cache":["miss"],"X-Powered-By":["Phusion Passenger Enterprise"],"Server":["nginx + Phusion Passenger"],"Access-Control-Allow-Origin":["*"],"Access-Control-Allow-Credentials":["false"],"Access-Control-Allow-Methods":["GET, POST, PUT, DELETE, OPTIONS"],"Access-Control-Allow-Headers":["X-TrackerToken,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Tracker-Warn-Unless-Project-Version-Is"],"X-Tracker-Client-Pinger-Interval":["12"]},"body":{"encoding":"UTF-8","string":"[{\"kind\":\"comment\",\"id\":120836920,\"story_id\":66728004,\"text\":\"This is a comment.\",\"person_id\":1266314,\"created_at\":\"2015-12-17T22:13:55Z\",\"updated_at\":\"2015-12-17T22:13:55Z\"},{\"kind\":\"comment\",\"id\":120836938,\"story_id\":66728004,\"text\":\"This is another comment.\",\"person_id\":1266314,\"created_at\":\"2015-12-17T22:14:04Z\",\"updated_at\":\"2015-12-17T22:14:04Z\"}]"},"http_version":null},"recorded_at":"Thu, 17 Dec 2015 22:19:11 GMT"}],"recorded_with":"VCR 2.9.3"}
|
data/tracker_api.gemspec
CHANGED
@@ -23,7 +23,6 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency 'minitest'
|
24
24
|
spec.add_development_dependency 'awesome_print'
|
25
25
|
spec.add_development_dependency 'vcr'
|
26
|
-
spec.add_development_dependency 'multi_json'
|
27
26
|
|
28
27
|
spec.add_dependency 'addressable'
|
29
28
|
spec.add_dependency 'virtus'
|
@@ -31,6 +30,6 @@ Gem::Specification.new do |spec|
|
|
31
30
|
spec.add_dependency 'faraday_middleware'
|
32
31
|
spec.add_dependency 'excon'
|
33
32
|
spec.add_dependency 'equalizer'
|
34
|
-
spec.add_dependency 'oj'
|
35
33
|
spec.add_dependency 'representable'
|
34
|
+
spec.add_dependency 'multi_json'
|
36
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tracker_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Forest Carlisle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: multi_json
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: addressable
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,7 +165,7 @@ dependencies:
|
|
179
165
|
- !ruby/object:Gem::Version
|
180
166
|
version: '0'
|
181
167
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
168
|
+
name: representable
|
183
169
|
requirement: !ruby/object:Gem::Requirement
|
184
170
|
requirements:
|
185
171
|
- - ">="
|
@@ -193,7 +179,7 @@ dependencies:
|
|
193
179
|
- !ruby/object:Gem::Version
|
194
180
|
version: '0'
|
195
181
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
182
|
+
name: multi_json
|
197
183
|
requirement: !ruby/object:Gem::Requirement
|
198
184
|
requirements:
|
199
185
|
- - ">="
|
@@ -288,6 +274,7 @@ files:
|
|
288
274
|
- test/vcr/cassettes/get_project_with_labels.json
|
289
275
|
- test/vcr/cassettes/get_story.json
|
290
276
|
- test/vcr/cassettes/get_story_activity.json
|
277
|
+
- test/vcr/cassettes/get_story_comments.json
|
291
278
|
- test/vcr/cassettes/get_story_owners.json
|
292
279
|
- test/vcr/cassettes/get_story_with_owners.json
|
293
280
|
- test/vcr/cassettes/get_story_with_tasks.json
|
@@ -321,7 +308,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
321
308
|
version: '0'
|
322
309
|
requirements: []
|
323
310
|
rubyforge_project:
|
324
|
-
rubygems_version: 2.
|
311
|
+
rubygems_version: 2.4.5.1
|
325
312
|
signing_key:
|
326
313
|
specification_version: 4
|
327
314
|
summary: API client for the Pivotal Tracker v5 API
|
@@ -354,6 +341,7 @@ test_files:
|
|
354
341
|
- test/vcr/cassettes/get_project_with_labels.json
|
355
342
|
- test/vcr/cassettes/get_story.json
|
356
343
|
- test/vcr/cassettes/get_story_activity.json
|
344
|
+
- test/vcr/cassettes/get_story_comments.json
|
357
345
|
- test/vcr/cassettes/get_story_owners.json
|
358
346
|
- test/vcr/cassettes/get_story_with_owners.json
|
359
347
|
- test/vcr/cassettes/get_story_with_tasks.json
|