Ruby Rally Rest API查询父项目下的项目

时间:2014-08-13 22:52:39

标签: ruby api rest rally

我正在尝试使用Ruby Rally API查询给定项目下的项目列表。但是我收到的结果包括 WORKSPACE下的每个项目。不只是父项目下的那些。难道我做错了什么?这是一个错误吗?

WSAPI version 1.43 
rally_api v1.0.1 ruby v2.0.0 

这是我设置查询对象的剪辑(使用假参考)

  #==================== Querying Rally ==========================
  project_query = RallyAPI::RallyQuery.new()
  project_query.type = :project
  project_query.fetch = $initial_fetch
  project_query.page_size = 200 #optional - default is 200
  project_query.limit = 50000 #optional - default is 99999
  project_query.order = "Name Asc"
  project_query.project_scope_down = true
  project_query.project_scope_up = false
  project_query.workspace = { "_ref" => "https://rally1.rallydev.com/slm/webservice/1.43/workspace/1234567890.js"}
  project_query.project = { "_ref" => "https://rally1.rallydev.com/slm/webservice/1.43/project/1234567890.js"}

  initial_project_query_results = @rally.find(project_query)

enter image description here

1 个答案:

答案 0 :(得分:0)

在您发布的代码片段中,我没有看到限制查询范围的实际查询。如果省略query,则返回所有对象。 这是一个带有显式查询的片段:

rally = RallyAPI::RallyRestJson.new(config)

query = RallyAPI::RallyQuery.new()
query.fetch = "Name,Owner"
query.type = :project   
query.query_string = "((Name = \"My Project\") OR (Parent.Name = \"My Project)\"))"

results = rally.find(query)

results.each do |p|
    p.read
    puts "opened project: #{p["Name"]} owner: #{p["Owner"]["_refObjectName"]}"
end

另外,不再支持1.43的WS API。要将ruby工具包与WS API v2.0一起使用,您与Rally的连接可能包含此配置属性:

config[:version] = "v2.0"