0

所以我有这个使用拉力赛的查询:

query_result = stuff.slm.find(:hierarchical_requirement, :project => project, :workspace => stuff.workspace, :project_scope_up => false, :project_scope_down => true){ equal :name, parent_name.strip }

然后我做,

parent = query_result.results.first

我很想知道什么样的对象被分配给了父母。我不在 Rally 的例外列表中,因此无法运行脚本。但是我正在为这个脚本编写一个 SSO 集成并且遇到了一些问题。如果我检查“父”,我觉得我的问题会得到解决,因为该函数正在返回这个“父”。如果有人对此有任何信息,请分享。谢谢!

4

1 回答 1

0

分配了一个故事 (HierarchicalRequirement) 对象。使用Rally Ruby REST 工具包

下面的代码打印:

my_story: abc, FormattedID: US86, _ref:https://rally1.rallydev.com/slm/webservice/v2.0/hierarchicalrequirement/12891971030

.

@rally = RallyAPI::RallyRestJson.new(config)
some_name = "abc"
query = RallyAPI::RallyQuery.new()
query.type = :story
query.fetch = "FormattedID"
query.query_string = "(Name = \"#{some_name}\")"
results = @rally.find(query)

my_story = results.first
puts "my_story: #{my_story}, FormattedID: #{my_story["FormattedID"]}, _ref:#{my_story["_ref"]}"

如果在您的代码中您尝试查找基于 FormattedID 的用户故事,这里有一个示例。它是否是父母并不重要,因为故事的父母就是故事,为了清楚起见,我在脚本中使用了“故事”而不是“父母”。在此示例中,将 FormattedID 作为命令行参数输入。注意我使用story = result.first,而不是story=result。这是输出的屏幕截图:

在此处输入图像描述

require 'rally_api'

#Setup custom app information
headers = RallyAPI::CustomHttpHeader.new()
headers.name = "find story"
headers.vendor = "Nick M RallyLab"
headers.version = "1.0"

# Connection to Rally
config = {:base_url => "https://rally1.rallydev.com/slm"}
config[:username] = "user@co.com"
config[:password] = "secret"
config[:workspace] = "X"
config[:project] = "Y"
config[:version] = "v2.0"
config[:headers] = headers #from RallyAPI::CustomHttpHeader.new()

unless ARGV.length == 1
  puts "enter one argument, e.g. US123, with no spaces"
  exit
end

story = nil
story_id = ARGV[0]
puts "find story by FormattedID: #{story_id}"

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

query = RallyAPI::RallyQuery.new()
query.type = :story
query.fetch = "Name,FormattedID,ScheduleState"
query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1111.js" } 
query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/2222.js" } 
query.project_scope_up = true
query.project_scope_down = true

query.query_string = "(FormattedID = \"#{story_id}\")"  

result = @rally.find(query)

if(result.length > 0)
    puts "found the story"
    story = result.first
    puts "FormattedID: #{story["FormattedID"]}, Name: #{story["Name"]}, ScheduleState: #{story["ScheduleState"]}"
else
   puts "did not find a story with FormattedID #{story_id}" 
end 
puts story.class
puts story.inspect
于 2013-10-02T20:14:35.837 回答