Skip to content

Commit d1e91a7

Browse files
committed
Add workspaceRef to delete()
1 parent 60af09e commit d1e91a7

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

Rally.RestApi.Test/RallyRestApiTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public void DeleteTest()
152152
Assert.AreEqual(0, response.Errors.Count);
153153
Assert.AreEqual(0, response.Warnings.Count);
154154
Assert.IsTrue(response.Reference.ToLower().Contains("defect"));
155-
OperationResult deleteResponse = restApi.Delete(Ref.GetRelativeRef(response.Reference));
155+
OperationResult deleteResponse = restApi.Delete(null,Ref.GetRelativeRef(response.Reference));
156156
dynamic testDefectEmpty = restApi.GetByReference(response.Reference);
157157
Assert.IsNull(testDefectEmpty);
158158
}

Rally.RestApi/RallyRestApi.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,24 +394,25 @@ public dynamic GetByReference(string aRef, params string[] fetchedFields)
394394
/// <param name="typePath">the type</param>
395395
/// <param name="oid">the object id</param>
396396
/// <returns>An OperationResult with information on the status of the request</returns>
397-
public OperationResult Delete(string typePath, long oid)
397+
public OperationResult Delete(string workspaceRef, string typePath, long oid)
398398
{
399-
return Delete(string.Format("/{0}/{1}", typePath, oid));
399+
return Delete(workspaceRef, string.Format("/{0}/{1}", typePath, oid));
400400
}
401401

402402
/// <summary>
403403
/// Delete the object described by the specified reference.
404404
/// </summary>
405405
/// <param name="aRef">the reference</param>
406406
/// <returns>An OperationResult with information on the status of the request</returns>
407-
public OperationResult Delete(string aRef)
407+
public OperationResult Delete(string workspaceRef, string aRef)
408408
{
409409
var result = new OperationResult();
410410
if (!aRef.Contains(".js"))
411411
{
412412
aRef = aRef + ".js";
413413
}
414-
dynamic response = serializer.Deserialize(Service.Delete(GetFullyQualifiedUri(aRef), GetProcessedHeaders()));
414+
String workspaceClause = workspaceRef == null ? "" : "?workspace=" + workspaceRef;
415+
dynamic response = serializer.Deserialize(Service.Delete(GetFullyQualifiedUri(aRef + workspaceClause), GetProcessedHeaders()));
415416
result.Errors.AddRange(DecodeArrayList(response.OperationResult.Errors));
416417
result.Warnings.AddRange(DecodeArrayList(response.OperationResult.Warnings));
417418
return result;
@@ -420,6 +421,7 @@ public OperationResult Delete(string aRef)
420421
/// <summary>
421422
/// Create an object of the specified type from the specified object
422423
/// </summary>
424+
/// <param name="workspaceRef">the workspace into which the object should be created</param>
423425
/// <param name="typePath">the type to be created</param>
424426
/// <param name="obj">the object to be created</param>
425427
/// <returns></returns>

0 commit comments

Comments
 (0)