tracker_api 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tracker_api.rb +1 -0
- data/lib/tracker_api/endpoints/tasks.rb +18 -0
- data/lib/tracker_api/resources/story.rb +8 -0
- data/lib/tracker_api/version.rb +1 -1
- data/test/story_test.rb +20 -0
- data/test/vcr/cassettes/get_tasks.json +1 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7793fe2c2e8736d0a9ee554fe4235e5650972ec0
|
4
|
+
data.tar.gz: 8d42a92f7700283678f2d9aa1dafcb4ef356f4dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecd29246f3c13ba882b16949070dc4c3dbffd3647610ab74445146486f4bb911b11187f7766d71f568e2b62b7fcf9d0352daf2fd4d3b36c2f869c048b97a7b2c
|
7
|
+
data.tar.gz: a2cd38c0ee78666f65cdb1eaf03012b93bc1bf73c6d7dd49bc4df1e49d260926edfc35b2f37751064fde179c284586e6939487601961e03f6430df72ae9992ad
|
data/lib/tracker_api.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
module TrackerApi
|
2
|
+
module Endpoints
|
3
|
+
class Tasks
|
4
|
+
attr_accessor :client
|
5
|
+
|
6
|
+
def initialize(client)
|
7
|
+
@client = client
|
8
|
+
end
|
9
|
+
|
10
|
+
def get(project_id, story_id, params={})
|
11
|
+
data = client.paginate("/projects/#{project_id}/stories/#{story_id}/tasks", params: params)
|
12
|
+
raise TrackerApi::Errors::UnexpectedData, 'Array of tasks expected' unless data.is_a? Array
|
13
|
+
|
14
|
+
data.map { |task| Resources::Task.new({ client: client }.merge(task)) }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -34,6 +34,14 @@ module TrackerApi
|
|
34
34
|
def label_list
|
35
35
|
@label_list ||= labels.collect(&:name).join(',')
|
36
36
|
end
|
37
|
+
|
38
|
+
def tasks(params = {})
|
39
|
+
if @tasks.any?
|
40
|
+
@tasks
|
41
|
+
else
|
42
|
+
@tasks = Endpoints::Tasks.new(client).get(project_id, id, params)
|
43
|
+
end
|
44
|
+
end
|
37
45
|
end
|
38
46
|
end
|
39
47
|
end
|
data/lib/tracker_api/version.rb
CHANGED
data/test/story_test.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require_relative 'minitest_helper'
|
2
|
+
|
3
|
+
describe TrackerApi::Resources::Story do
|
4
|
+
let(:pt_user) { PT_USER_1 }
|
5
|
+
let(:client) { TrackerApi::Client.new token: pt_user[:token] }
|
6
|
+
let(:project_id) { pt_user[:project_id] }
|
7
|
+
let(:project) { VCR.use_cassette('get project') { client.project(project_id) } }
|
8
|
+
|
9
|
+
describe '.tasks' do
|
10
|
+
it "gets all tasks for this story" do
|
11
|
+
VCR.use_cassette('get tasks', record: :new_episodes) do
|
12
|
+
tasks = project.story('66728004').tasks
|
13
|
+
|
14
|
+
tasks.wont_be_empty
|
15
|
+
task = tasks.first
|
16
|
+
task.must_be_instance_of TrackerApi::Resources::Task
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"https://www.pivotaltracker.com/services/v5/projects/1027488/stories/66728004","body":{"encoding":"US-ASCII","string":""},"headers":{"User-Agent":["Ruby/2.0.0 (x86_64-darwin12.3.0; ruby) TrackerApi/0.2.3 Faraday/0.8.9"],"X-TrackerToken":["d55c3bc1f74346b843ca84ba340b29bf"]}},"response":{"status":{"code":200,"message":null},"headers":{"content-type":["application/json; charset=utf-8"],"transfer-encoding":["chunked"],"connection":["close"],"status":["200 OK"],"x-tracker-project-version":["4"],"x-ua-compatible":["IE=Edge,chrome=1"],"cache-control":["max-age=0, private, must-revalidate"],"x-request-id":["e0e1e5a5a858021bab77c122695ee128"],"x-runtime":["0.052749"],"date":["Mon, 02 Jun 2014 12:46:55 GMT"],"x-rack-cache":["miss"],"x-powered-by":["Phusion Passenger 4.0.41"],"server":["nginx/1.6.0 + Phusion Passenger 4.0.41"],"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"]},"body":{"encoding":"UTF-8","string":"{\n \"kind\": \"story\",\n \"id\": 66728004,\n \"project_id\": 1027488,\n \"name\": \"Some product photos not scaled properly when browsing products\",\n \"story_type\": \"bug\",\n \"current_state\": \"started\",\n \"requested_by_id\": 1266314,\n \"owner_ids\": [\n\n ],\n \"labels\": [\n {\n \"kind\": \"label\",\n \"id\": 7849082,\n \"project_id\": 1027488,\n \"name\": \"shopping\",\n \"created_at\": \"2014-03-02T07:11:04Z\",\n \"updated_at\": \"2014-03-02T07:11:04Z\"\n }\n ],\n \"created_at\": \"2014-02-17T00:00:00Z\",\n \"updated_at\": \"2014-06-02T12:44:52Z\",\n \"url\": \"https://www.pivotaltracker.com/story/show/66728004\"\n}"},"http_version":null},"recorded_at":"Mon, 02 Jun 2014 12:52:37 GMT"},{"request":{"method":"get","uri":"https://www.pivotaltracker.com/services/v5/projects/1027488/stories/66728004/tasks","body":{"encoding":"US-ASCII","string":""},"headers":{"User-Agent":["Ruby/2.0.0 (x86_64-darwin12.3.0; ruby) TrackerApi/0.2.3 Faraday/0.8.9"],"X-TrackerToken":["d55c3bc1f74346b843ca84ba340b29bf"]}},"response":{"status":{"code":200,"message":null},"headers":{"content-type":["application/json; charset=utf-8"],"transfer-encoding":["chunked"],"connection":["close"],"status":["200 OK"],"x-tracker-project-version":["4"],"x-ua-compatible":["IE=Edge,chrome=1"],"cache-control":["max-age=0, private, must-revalidate"],"x-request-id":["c19e49aeed631790cc3ee99e22715c18"],"x-runtime":["0.046243"],"date":["Mon, 02 Jun 2014 12:46:56 GMT"],"x-rack-cache":["miss"],"x-powered-by":["Phusion Passenger 4.0.41"],"server":["nginx/1.6.0 + Phusion Passenger 4.0.41"],"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"]},"body":{"encoding":"UTF-8","string":"[\n {\n \"kind\": \"task\",\n \"id\": 22778038,\n \"story_id\": 66728004,\n \"description\": \"Check unscaled\",\n \"complete\": false,\n \"position\": 1,\n \"created_at\": \"2014-06-02T12:44:52Z\",\n \"updated_at\": \"2014-06-02T12:44:52Z\"\n }\n]"},"http_version":null},"recorded_at":"Mon, 02 Jun 2014 12:52:39 GMT"},{"request":{"method":"get","uri":"https://www.pivotaltracker.com/services/v5/projects/1027488/stories/6672804","body":{"encoding":"US-ASCII","string":""},"headers":{"User-Agent":["Ruby/2.0.0 (x86_64-darwin12.3.0; ruby) TrackerApi/0.2.3 Faraday/0.8.9"],"X-TrackerToken":["d55c3bc1f74346b843ca84ba340b29bf"]}},"response":{"status":{"code":404,"message":null},"headers":{"content-type":["application/json; charset=utf-8"],"transfer-encoding":["chunked"],"connection":["close"],"status":["404 Not Found"],"x-ua-compatible":["IE=Edge,chrome=1"],"cache-control":["no-cache"],"x-request-id":["7ee0bc2a678807d2c329ead03d54c190"],"x-runtime":["0.032763"],"date":["Mon, 02 Jun 2014 12:47:18 GMT"],"x-rack-cache":["miss"],"x-powered-by":["Phusion Passenger 4.0.41"],"server":["nginx/1.6.0 + Phusion Passenger 4.0.41"]},"body":{"encoding":"UTF-8","string":"{\n \"code\": \"unfound_resource\",\n \"kind\": \"error\",\n \"error\": \"The object you tried to access could not be found. It may have been removed by another user, you may be using the ID of another object type, or you may be trying to access a sub-resource at the wrong point in a tree.\"\n}"},"http_version":null},"recorded_at":"Mon, 02 Jun 2014 12:53:00 GMT"}],"recorded_with":"VCR 2.9.2"}
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Forest Carlisle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- lib/tracker_api/endpoints/projects.rb
|
176
176
|
- lib/tracker_api/endpoints/stories.rb
|
177
177
|
- lib/tracker_api/endpoints/story.rb
|
178
|
+
- lib/tracker_api/endpoints/tasks.rb
|
178
179
|
- lib/tracker_api/error.rb
|
179
180
|
- lib/tracker_api/logger.rb
|
180
181
|
- lib/tracker_api/resources/account.rb
|
@@ -193,6 +194,7 @@ files:
|
|
193
194
|
- test/client_test.rb
|
194
195
|
- test/minitest_helper.rb
|
195
196
|
- test/project_test.rb
|
197
|
+
- test/story_test.rb
|
196
198
|
- test/vcr/cassettes/client_done_iterations_with_pagination.json
|
197
199
|
- test/vcr/cassettes/client_get_all_stories_with_pagination.json
|
198
200
|
- test/vcr/cassettes/get_all_projects.json
|
@@ -202,6 +204,7 @@ files:
|
|
202
204
|
- test/vcr/cassettes/get_me.json
|
203
205
|
- test/vcr/cassettes/get_project.json
|
204
206
|
- test/vcr/cassettes/get_project_with_epics.json
|
207
|
+
- test/vcr/cassettes/get_tasks.json
|
205
208
|
- test/vcr/cassettes/get_unscheduled_stories.json
|
206
209
|
- tracker_api.gemspec
|
207
210
|
homepage: https://github.com/dashofcode/tracker_api
|
@@ -232,6 +235,7 @@ test_files:
|
|
232
235
|
- test/client_test.rb
|
233
236
|
- test/minitest_helper.rb
|
234
237
|
- test/project_test.rb
|
238
|
+
- test/story_test.rb
|
235
239
|
- test/vcr/cassettes/client_done_iterations_with_pagination.json
|
236
240
|
- test/vcr/cassettes/client_get_all_stories_with_pagination.json
|
237
241
|
- test/vcr/cassettes/get_all_projects.json
|
@@ -241,4 +245,5 @@ test_files:
|
|
241
245
|
- test/vcr/cassettes/get_me.json
|
242
246
|
- test/vcr/cassettes/get_project.json
|
243
247
|
- test/vcr/cassettes/get_project_with_epics.json
|
248
|
+
- test/vcr/cassettes/get_tasks.json
|
244
249
|
- test/vcr/cassettes/get_unscheduled_stories.json
|