Rally Ruby 工具包:如何获取投资组合项目状态的 URL? [英] Rally Ruby toolkit: how to get URL of Portfolio Item's state?
本文介绍了Rally Ruby 工具包:如何获取投资组合项目状态的 URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Ruby 中是否有一个例子,使用rally_api 如何设置一个功能的状态,如上所述 这里?
Is there an example in Ruby using rally_api how to set State of a feature as mentioned here?
具体来说,有没有办法查询ObjectID或要使用的完全限定的状态路径
Specifically, is there a way to query the ObjectID or the fully qualified path of state to use
"State" => "Developing"
代替
"State" => "/state/<ObjectID>"
推荐答案
可以查询 State,创建散列,并用查询结果填充散列,其中 State Name 是键,State _ref 是值:
It is possible to query State, create a hash, and populate the hash with the query results, where State Name is the key and State _ref is the value:
state_results.each do |s|
s.read
state_hash[s["Name"]] = s["_ref"]
end
然后我们可以更新一个状态:
Then we can update a State:
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
这篇关于Rally Ruby 工具包:如何获取投资组合项目状态的 URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文