我正在尝试向csv输出一些Rally记录的对象引用(功能)。有没有人知道Rally api语法来获取PortfolioItem / Feature数据的记录?
提前致谢。
这是我的Python代码段。
def getUserStories():
response = rally.get("HierarchicalRequirement",fetch=True, pagesize=200, limit=50)
for item in response:
FIELDS = (item.FormattedID, item.Feature, item.Description,
item.Name, item.Notes, item.Parent)
yield FIELDS
这是打印FIELDS的输出: ([],你' US136',无,
第一列是标签,所以如果那里有记录,我会得到一个对象。第四列返回""。我需要从这个对象获取数据。提取数据的最佳方法是什么?
由于
答案 0 :(得分:0)
试试这段代码示例:
#
# Usage: ruby get_story_feature_short.rb <Story-FormattedID>
#
require './MyVars.rb' # Credential variables stored here
require 'rally_api'
headers = RallyAPI::CustomHttpHeader.new({:vendor=>"JP",:version=>"3.14"})
@rallycon = RallyAPI::RallyRestJson.new({
:base_url => $my_base_url,
:username => $my_username,
:password => $my_password,
:workspace => $my_workspace,
:project => $my_project,
:version => "v2.0",
:headers => headers})
qstring = {:type => :story,
:query_string => "(FormattedID = \"#{ARGV[0]}\")",
:fetch => 'true'}
stories = @rallycon.find(RallyAPI::RallyQuery.new(qstring))
my_us = stories.first # Take the first one (even though there is only one)
feature = my_us.Feature.read # Read the Feature
puts "User-story '#{ARGV[0]}' is part of Feature '#{feature.FormattedID}'"
答案 1 :(得分:0)
如果您需要获得特定功能,可以试试这个:
from pyral import Rally
SERVER = 'SERVER'
USER = 'USER'
PASSWORD = 'PASSWORD'
WORKSPACE = 'WORKSPACE'
PROJECT = 'PROJECT'
TARGET = 'FEATURE_ID'
if __name__ == '__main__':
rally = Rally(SERVER, USER, PASSWORD, workspace=WORKSPACE, project=PROJECT)
feature_req = rally.get('Feature', fetch=True, query='FormattedID = %s' % (TARGET))
feature = feature_req.next()
#do all required operations with fields
print feature.details()
如果您想从Project获取所有功能,请使用以下方法:
from pyral import Rally
SERVER = 'SERVER'
USER = 'USER'
PASSWORD = 'PASSWORD'
WORKSPACE = 'WORKSPACE'
PROJECT = 'PROJECT'
if __name__ == '__main__':
rally = Rally(SERVER, USER, PASSWORD, workspace=WORKSPACE, project=PROJECT)
features = rally.get('Feature', fetch=True, pagesize=200)
for feature in features:
#do all required operations with fields
pass