tracker_api 1.11.0 → 1.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +4 -0
- data/lib/tracker_api.rb +1 -0
- data/lib/tracker_api/endpoints/review.rb +21 -0
- data/lib/tracker_api/resources/review.rb +17 -1
- data/lib/tracker_api/version.rb +1 -1
- data/test/review_test.rb +27 -0
- data/test/vcr/cassettes/save_review.json +1 -0
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7d0c3f349c8d57bc33c44401068ae359892d33a8d8ed2c5c20ed96110fe02b3b
|
4
|
+
data.tar.gz: adac66edc9ddf17883734c6908b1cce46cbac8b932702a7c3f31573b0ad38b13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea30f0006b6dff8684c3d46381d65ddfc00d3a481fbcea3489f844c7bb2c687b065e618114af8cd4392c63d770fcf1ad1ea86aad1305a5c8fca4f95ba58d7150
|
7
|
+
data.tar.gz: e67ea8cd72e9947862bdd58230aecea038e311a14ecb081f65545003f2fb3d7924c680c55a4d34a1711492f9509a2da6c368d1c93689c7b9f92f2a91e8faf267
|
data/README.md
CHANGED
@@ -86,6 +86,10 @@ task = story.tasks.first # Get
|
|
86
86
|
task.complete = true
|
87
87
|
task.save # Mark a task complete
|
88
88
|
|
89
|
+
review = story.reviews.first # Mark a review as complete
|
90
|
+
review.status = 'pass'
|
91
|
+
review.save
|
92
|
+
|
89
93
|
epics = project.epics # Get all epics for a project
|
90
94
|
epic = epics.first
|
91
95
|
label = epic.label # Get an epic's label
|
data/lib/tracker_api.rb
CHANGED
@@ -66,6 +66,7 @@ module TrackerApi
|
|
66
66
|
autoload :Attachments, 'tracker_api/endpoints/attachments'
|
67
67
|
autoload :Releases, 'tracker_api/endpoints/releases'
|
68
68
|
autoload :Release, 'tracker_api/endpoints/release'
|
69
|
+
autoload :Review, 'tracker_api/endpoints/review'
|
69
70
|
autoload :Reviews, 'tracker_api/endpoints/reviews'
|
70
71
|
end
|
71
72
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module TrackerApi
|
2
|
+
module Endpoints
|
3
|
+
class Review
|
4
|
+
attr_accessor :client
|
5
|
+
|
6
|
+
def initialize(client)
|
7
|
+
@client = client
|
8
|
+
end
|
9
|
+
|
10
|
+
def update(review, params = {})
|
11
|
+
raise ArgumentError, 'Valid review required to update.' unless review.instance_of?(Resources::Review)
|
12
|
+
|
13
|
+
data = client.put("/projects/#{review.project_id}/stories/#{review.story_id}/reviews/#{review.id}", params: params).body
|
14
|
+
|
15
|
+
review.attributes = data
|
16
|
+
review.clean!
|
17
|
+
review
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -7,6 +7,7 @@ module TrackerApi
|
|
7
7
|
|
8
8
|
attribute :id, Integer
|
9
9
|
attribute :story_id, Integer
|
10
|
+
attribute :project_id, Integer
|
10
11
|
attribute :review_type_id, Integer
|
11
12
|
attribute :reviewer_id, Integer
|
12
13
|
attribute :status, String # (unstarted, in_review, pass, revise)
|
@@ -14,6 +15,21 @@ module TrackerApi
|
|
14
15
|
attribute :updated_at, DateTime
|
15
16
|
attribute :kind, String
|
16
17
|
attribute :review_type, ReviewType
|
18
|
+
|
19
|
+
class UpdateRepresenter < Representable::Decorator
|
20
|
+
include Representable::JSON
|
21
|
+
|
22
|
+
property :id
|
23
|
+
property :review_type_id
|
24
|
+
property :reviewer_id
|
25
|
+
property :status
|
26
|
+
end
|
27
|
+
|
28
|
+
def save
|
29
|
+
raise ArgumentError, 'Cannot update a review with an unknown story_id.' if story_id.nil?
|
30
|
+
|
31
|
+
Endpoints::Review.new(client).update(self, UpdateRepresenter.new(Review.new(dirty_attributes)))
|
32
|
+
end
|
17
33
|
end
|
18
34
|
end
|
19
|
-
end
|
35
|
+
end
|
data/lib/tracker_api/version.rb
CHANGED
data/test/review_test.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'minitest_helper'
|
2
|
+
|
3
|
+
describe TrackerApi::Resources::Review do
|
4
|
+
let(:pt_user) { PT_USER_1 }
|
5
|
+
let(:client) { TrackerApi::Client.new token: pt_user[:token] }
|
6
|
+
let(:story) do
|
7
|
+
TrackerApi::Resources::Story.new(
|
8
|
+
client: client,
|
9
|
+
project_id: pt_user[:project_id],
|
10
|
+
id: '66728004'
|
11
|
+
)
|
12
|
+
end
|
13
|
+
let(:reviews) { VCR.use_cassette('get story reviews') { story.reviews } }
|
14
|
+
let(:existing_review) { reviews.first }
|
15
|
+
|
16
|
+
it 'can update an existing review' do
|
17
|
+
new_state = 'pass'
|
18
|
+
existing_review.status = new_state
|
19
|
+
|
20
|
+
VCR.use_cassette('save review', record: :new_episodes) do
|
21
|
+
existing_review.save
|
22
|
+
end
|
23
|
+
|
24
|
+
_(existing_review.status).must_equal new_state
|
25
|
+
_(existing_review.clean?).must_equal true
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{ "http_interactions": [ { "request": { "method": "put", "uri": "https://www.pivotaltracker.com/services/v5/projects/1027488/stories/66728004/reviews/1129224", "body": { "encoding": "UTF-8", "string": "{\"status\":\"pass\"}" }, "headers": { "User-Agent": [ "Ruby/2.3.1 (x86_64-darwin15; ruby) TrackerApi/1.7.0 Faraday/0.9.2" ], "X-TrackerToken": ["d55c3bc1f74346b843ca84ba340b29bf"], "Content-Type": ["application/json"] } }, "response": { "status": { "code": 200, "message": null }, "headers": { "Access-Control-Allow-Credentials": ["false"], "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" ], "Access-Control-Allow-Methods": ["GET, POST, PUT, DELETE, OPTIONS"], "Access-Control-Allow-Origin": ["*"], "Cache-Control": ["max-age=0, private, must-revalidate"], "Content-Type": ["application/json; charset=utf-8"], "Date": ["Wed, 03 May 2017 23:29:39 GMT"], "Etag": ["\"32f56ee2d2f58495f5243892aa8ab824\""], "Server": ["nginx + Phusion Passenger"], "Status": ["200 OK"], "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains; preload" ], "X-Content-Type-Options": ["nosniff"], "X-Powered-By": ["Phusion Passenger Enterprise"], "X-Rack-Cache": ["invalidate, pass"], "X-Request-Id": ["51304f42f751d73a2484764013fcd838"], "X-Runtime": ["0.344871"], "X-Tracker-Client-Pinger-Interval": ["20"], "X-Tracker-Project-Version": ["231"], "X-Ua-Compatible": ["IE=Edge,chrome=1"], "X-Vcap-Request-Id": ["76b36118-3332-4513-5eef-f0667c4b9bb6"], "X-Xss-Protection": ["1; mode=block"], "Content-Length": ["176"], "Connection": ["keep-alive"] }, "body": { "encoding": "ASCII-8BIT", "string": "{\"kind\":\"review\",\"id\":1129224,\"story_id\":66728004,\"review_type_id\":2293634,\"reviewer_id\":1266314,\"status\":\"pass\",\"created_at\":\"2020-06-03T15:55:47Z\",\"updated_at\":\"2020-06-03T15:56:00Z\"}" }, "http_version": null }, "recorded_at": "Wed, 03 May 2017 23:29:39 GMT" } ], "recorded_with": "VCR 2.9.3" }
|
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: 1.
|
4
|
+
version: 1.12.0
|
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: 2021-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -255,6 +255,7 @@ files:
|
|
255
255
|
- lib/tracker_api/endpoints/projects.rb
|
256
256
|
- lib/tracker_api/endpoints/release.rb
|
257
257
|
- lib/tracker_api/endpoints/releases.rb
|
258
|
+
- lib/tracker_api/endpoints/review.rb
|
258
259
|
- lib/tracker_api/endpoints/reviews.rb
|
259
260
|
- lib/tracker_api/endpoints/search.rb
|
260
261
|
- lib/tracker_api/endpoints/stories.rb
|
@@ -313,6 +314,7 @@ files:
|
|
313
314
|
- test/minitest_helper.rb
|
314
315
|
- test/project_test.rb
|
315
316
|
- test/release_test.rb
|
317
|
+
- test/review_test.rb
|
316
318
|
- test/story_test.rb
|
317
319
|
- test/task_test.rb
|
318
320
|
- test/vcr/cassettes/client_done_iterations_with_pagination.json
|
@@ -370,6 +372,7 @@ files:
|
|
370
372
|
- test/vcr/cassettes/release_stories.json
|
371
373
|
- test/vcr/cassettes/save_comment.json
|
372
374
|
- test/vcr/cassettes/save_previously_no_label_story_with_new_label.json
|
375
|
+
- test/vcr/cassettes/save_review.json
|
373
376
|
- test/vcr/cassettes/save_story.json
|
374
377
|
- test/vcr/cassettes/save_story_in_epic.json
|
375
378
|
- test/vcr/cassettes/save_story_with_multiple_changes.json
|
@@ -454,8 +457,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
454
457
|
- !ruby/object:Gem::Version
|
455
458
|
version: '0'
|
456
459
|
requirements: []
|
457
|
-
|
458
|
-
rubygems_version: 2.5.2.3
|
460
|
+
rubygems_version: 3.1.4
|
459
461
|
signing_key:
|
460
462
|
specification_version: 4
|
461
463
|
summary: API client for the Pivotal Tracker v5 API
|
@@ -468,6 +470,7 @@ test_files:
|
|
468
470
|
- test/minitest_helper.rb
|
469
471
|
- test/project_test.rb
|
470
472
|
- test/release_test.rb
|
473
|
+
- test/review_test.rb
|
471
474
|
- test/story_test.rb
|
472
475
|
- test/task_test.rb
|
473
476
|
- test/vcr/cassettes/client_done_iterations_with_pagination.json
|
@@ -525,6 +528,7 @@ test_files:
|
|
525
528
|
- test/vcr/cassettes/release_stories.json
|
526
529
|
- test/vcr/cassettes/save_comment.json
|
527
530
|
- test/vcr/cassettes/save_previously_no_label_story_with_new_label.json
|
531
|
+
- test/vcr/cassettes/save_review.json
|
528
532
|
- test/vcr/cassettes/save_story.json
|
529
533
|
- test/vcr/cassettes/save_story_in_epic.json
|
530
534
|
- test/vcr/cassettes/save_story_with_multiple_changes.json
|