gpt4 book ai didi

ruby - 集会 API : documentation list of fields for portfolio items?

转载 作者:太空宇宙 更新时间:2023-11-03 18:21:55 26 4
gpt4 key购买 nike

我正在通过 Ruby 使用 Rally API ( http://developer.help.rallydev.com/ruby-toolkit-rally-rest-api-json )。我想查询投资组合项目的属性(字段?)。我有工作代码,例如这工作正常(虽然它似乎显示名称,而不是 ID——我期待类似“T30”的东西,但它显示“这是我的倡议的名称”):

pi_query.order = "FormattedID Asc"

通过反复试验,我也看到了

pi_query.order = "Name Asc"

也可以。我的问题:我可以在这里使用什么值?我已经找了几个小时了。 Name、FormattedID 和 Description 有效; parent 没有。我找不到引用文档。

(我正在尝试编写一个显示投资组合项目的自定义报告,这是一种更具可读性的方式——主题、倡议和功能以某种我可以打印的嵌套方式显示。Rally 中的投资组合层次结构应用程序不提供可打印的 View ,所以我希望为它编写一个快速脚本。我不需要太多,主要是名称,以及它是主题、倡议还是功能。像这样:)

T30 My first theme
I65 The first initiative
F44 The first feature under that
F45 Another feature
I66 Another initiative
T31 My second theme
I67 Yet another initiative

最佳答案

我找到了。这是文档的正确链接:

https://rally1.rallydev.com/slm/doc/webservice/

如果您单击左侧的“AllowedAttributeValue”,您将获得一个属性列表。按 Ctrl-F 并搜索“投资组合”。当您进入标题为“Portfolio Item (non-creatable type)”的主标题时,会出现一个用于“获取完整对象”和“美化 JSON 输出”的复选框。检查两者,然后点击下方的“查询”按钮。您将在新窗口中获得一个对象模型。

在这个新窗口中,您可以看到所有有效属性。例如,搜索“Parent”,您可以看到 Parent 散列的有效值。其中一个键是 _refObjectName,它为您提供父节点的名称。

这是一个工作示例,它查询计划并显示他们的名字和他们 parent 的名字。

require 'rally_api'

config = {:base_url => "https://rally1.rallydev.com/slm"}
config[:username] = "REPLACE"
config[:password] = "REPLACE"
config[:workspace] = "REPLACE"
config[:project] = "REPLACE"
@rally = RallyAPI::RallyRestJson.new(config)

pi_query = RallyAPI::RallyQuery.new()
pi_query.type = "portfolioitem/initiative"
pi_query.fetch = "Name,FormattedID,Description,PortfolioItemTypeName,Parent"
pi_query.project_scope_up = true
pi_query.project_scope_down = true
pi_query.order = "FormattedID Asc"
pi_results = @rally.find(pi_query)

pi_results.each do |result|
parent_name = (result.Parent == nil)? "" : "has parent \"" + result.Parent["_refObjectName"] + "\""
puts result.FormattedID + " " + result.Name + " " + parent_name
end

关于ruby - 集会 API : documentation list of fields for portfolio items?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16869602/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com