0

WS API ドキュメントに c_MyCustomField として表示される Rally アーティファクトのカスタム フィールドがあります。

しかし、それは印刷されません:

results = @rally.find(query)

results.each do |d|
       puts "Name: #{d["Name"]}, FormattedID: #{d["FormattedID"]}, Owner: #{d["Owner"]["UserName"]}, MyCustomField: #{d["c_MyCustomField"]}"
       d.read
end
4

1 に答える 1

0

まず、フィールドがフェッチされていることを確認します。

query.fetch = "c_MyCustomField"

次に、v2.0 を使用する場合は、WS API のバージョンを明示的に設定する必要があります。

c_ プレフィックスは、WS API バージョン v2.0 に固有です。デフォルトでは、rally_api は以前のバージョンの WS API を使用します。コードで WS API のバージョンを明示的に指定しない場合は、以前のバージョンの WS API で参照されていたように、c_ なしでカスタム フィールドを参照してください。

results.each do |d|
    puts "MyCustomField: #{d["MyCustomField"]}"
    d.read
end

コードに最新バージョンの WS API が設定されている場合:

config[:version] = "v2.0"

次に、カスタム フィールドの前に c_ が必要です。

results.each do |d|
    puts "MyCustomField: #{d["c_MyCustomField"]}"
    d.read
end

これは、最新の rally_api gem でRallyRestTookitForRubyを使用していることを前提としています。

gem list -l

rally_api 0.9.20 をリストする必要があります

古い rally_rest_api はサポートされていないことに注意してください。また、WS API の v2.0 では動作しません。

以下は Ruby スクリプトの例です。

require 'rally_api'

#Setup custom app information
headers = RallyAPI::CustomHttpHeader.new()
headers.name = "My Utility"
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] = "W1"
config[:project] = "P1"
config[:version] = "v2.0"
config[:headers] = headers #from RallyAPI::CustomHttpHeader.new()

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

query = RallyAPI::RallyQuery.new()
query.type = :defect
query.fetch = "c_MyCustomField"
query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1111.js" } #optional
query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/2222.js" } #Team Group 1 from Product 2
query.page_size = 200 #optional - default is 200
query.limit = 1000 #optional - default is 99999
query.project_scope_up = false
query.project_scope_down = true
query.order = "Name Asc"
query.query_string = "(Owner.UserName = someuser@co.com)"

results = @rally.find(query)

results.each do |d|
    puts "MyCustomField: #{d["c_MyCustomField"]}"
    d.read
end
于 2013-08-27T23:50:05.547 に答える