0
Ruby中使用rally_api如何設置如上所述的功能狀態here?Rally Ruby工具包:如何獲取Portfolio Item狀態的URL?
具體來說,就是有沒有辦法查詢對象ID或狀態的使用
"State" => "Developing"
代替
"State" => "/state/<ObjectID>"
Ruby中使用rally_api如何設置如上所述的功能狀態here?Rally Ruby工具包:如何獲取Portfolio Item狀態的URL?
具體來說,就是有沒有辦法查詢對象ID或狀態的使用
"State" => "Developing"
代替
"State" => "/state/<ObjectID>"
它可以查詢國家,創建哈希完全合格的路徑,並使用查詢結果填充散列,其中State Name是關鍵字,State _ref是該值:
state_results.each do |s|
s.read
state_hash[s["Name"]] = s["_ref"]
end
然後,我們可以更新狀態:
features.each do |f|
field_updates={"State" => state_hash["Developing"]}
f.update(field_updates)
end
這裏是一個代碼示例:
@rally = RallyAPI::RallyRestJson.new(config)
queryState = RallyAPI::RallyQuery.new()
queryState.type = :state
queryState.fetch = "true"
queryState.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/11111" }
queryState.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/22222" } #use valid OIDs
queryState.query_string = "(TypeDef.Name = \"Feature\")"
state_hash = Hash.new
state_results = @rally.find(queryState)
state_results.each do |s|
s.read
#puts "Ref: #{s["_ref"]}, Name: #{s["Name"] }, TypeDef: #{s["TypeDef"]}"
state_hash[s["Name"]] = s["_ref"]
end
query = RallyAPI::RallyQuery.new()
query.type = "portfolioitem/feature"
query.fetch = "Name,FormattedID"
query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1111" }
query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/22222" } #use valid OIDs
query.query_string = "(Name = \"my feature\")"
results = @rally.find(query)
features = [];
results.each do |f|
f.read
puts "Current state of Feature #{f["FormattedID"]}: #{f["State"].to_s}"
features << f
end
features.each do |f|
field_updates={"State" => state_hash["Developing"]}
f.update(field_updates)
puts "Feature #{f["FormattedID"]} is now in State: #{f["State"].to_s}"
end