Ruby on rails 基于迭代获取缺陷的rally_api查询

Ruby on rails 基于迭代获取缺陷的rally_api查询,ruby-on-rails,ruby,json,ruby-on-rails-3,rally,Ruby On Rails,Ruby,Json,Ruby On Rails 3,Rally,我正在Ruby中使用rally_api gem。有谁能建议我如何编写查询,在特定的迭代中获取所有缺陷 require 'rally_api' headers = RallyAPI::CustomHttpHeader.new() headers.version = "1.0" config = {:base_url => "https://rally1.rallydev.com/slm"} config[:username] = "mvcmxb" config[:password]

我正在Ruby中使用rally_api gem。有谁能建议我如何编写查询,在特定的迭代中获取所有缺陷

require 'rally_api'
headers = RallyAPI::CustomHttpHeader.new()
headers.version = "1.0"

config = {:base_url => "https://rally1.rallydev.com/slm"}
config[:username]   = "mvcmxb"
config[:password]   = "kjkjk"
config[:workspace]  = "Persons"
config[:project]    = "Business he does"
config[:headers]    = headers 

@rally = RallyAPI::RallyRestJson.new(config)

test_query = RallyAPI::RallyQuery.new()
test_query.type = "defect"
test_query.fetch = true

results = @rally.find(test_query)   

下面是一个代码示例,当通过迭代查询缺陷并更新其描述时。您可以按迭代名称进行查询:

query.query_string = "(Iteration.Name = \"i10\")"
或迭代参考:

query.query_string="(Iteration = /iteration/13589769934)"
名称不唯一,但查询也受项目的约束:

rally = RallyAPI::RallyRestJson.new(config)
query = RallyAPI::RallyQuery.new()
query.type = :defect  
query.fetch = "Name,FormattedID,Iteration,Description"
query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/12352608219.js" } 
query.project_scope_up = false
query.project_scope_down = false
query.order = "Name Asc"
#query.query_string = "(Iteration.Name = \"i10\")"
query.query_string="(Iteration = /iteration/13589769934)"

results = rally.find(query)

results.each do |d|
    puts "FormattedID: #{d["FormattedID"]}, Iteration: #{d["Iteration"]["Name"]}"
    d.read
    fieldUpdates = { "Description" => "bad defect"}
    d.update(fieldUpdates)
end

请提供您尝试的解决方案。我只需要获取特定迭代的缺陷