是否有可能通过Ruby获取里程碑?

时间:2016-10-07 05:39:56

标签: ruby rally

我的脚本除里程碑外有效。我现在正在回收垃圾:

US59689 16-18 CSI-CSU #<RallyAPI::RallyCollection:0x51c94b0>

有没有办法通过Ruby获取用户故事里程碑?

    require 'rally_api'

    headers = RallyAPI::CustomHttpHeader.new({:vendor => "My Company", :name => "My Ruby Test Pgm", :version => "1.0"})

    config = {:base_url => "https://rally1.rallydev.com/slm"}
    config[:api_key]    = "myKey"
    config[:workspace]  = "myWkSpace"
    config[:project]    = "myProject"
    config[:headers]    = headers #from RallyAPI::CustomHttpHeader.new()
    config[:version]    = "v2.0"

    rally = RallyAPI::RallyRestJson.new(config)
    query = RallyAPI::RallyQuery.new()
    query.type = "userStory"
    query.fetch = "Project,Name,FormattedID,Iteration,Release,Milestones"
    query.project_scope_up = false
    query.project_scope_down = true
    query.order = "Name Asc"
    query.query_string = "(Release.Name = \"PPI-16E\")"

    results = rally.find(query)

    results.each do |defect|
      puts "#{defect["FormattedID"]} #{defect["Iteration"]} #{defect["Project"]} #{defect["Milestones"]}

end

1 个答案:

答案 0 :(得分:0)

试试这个:

....
results = rally.find(query)

results.each do |defect|
  puts "#{defect['FormattedID']} #{defect['Iteration']} #{defect['Project']}"
    defect['Milestones'].each do |ms|
      this_ms = rally.read('Milestone',ms.ObjectID)
      puts "\t#{this_ms['FormattedID']} #{this_ms['Name']}"
    end
end