Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module TrackerApi | ||
module Endpoints | ||
class Review | ||
attr_accessor :client | ||
|
||
def initialize(client) | ||
@client = client | ||
end | ||
|
||
def update(review, params = {}) | ||
raise ArgumentError, 'Valid review required to update.' unless review.instance_of?(Resources::Review) | ||
|
||
data = client.put("/projects/#{review.project_id}/stories/#{review.story_id}/reviews/#{review.id}", params: params).body | ||
|
||
review.attributes = data | ||
review.clean! | ||
review | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module TrackerApi | ||
VERSION = '1.11.0' | ||
VERSION = '1.12.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
require_relative 'minitest_helper' | ||
|
||
describe TrackerApi::Resources::Review do | ||
let(:pt_user) { PT_USER_1 } | ||
let(:client) { TrackerApi::Client.new token: pt_user[:token] } | ||
let(:story) do | ||
TrackerApi::Resources::Story.new( | ||
client: client, | ||
project_id: pt_user[:project_id], | ||
id: '66728004' | ||
) | ||
end | ||
let(:reviews) { VCR.use_cassette('get story reviews') { story.reviews } } | ||
let(:existing_review) { reviews.first } | ||
|
||
it 'can update an existing review' do | ||
new_state = 'pass' | ||
existing_review.status = new_state | ||
|
||
VCR.use_cassette('save review', record: :new_episodes) do | ||
existing_review.save | ||
end | ||
|
||
_(existing_review.status).must_equal new_state | ||
_(existing_review.clean?).must_equal true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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" } |