2013-10-02 6 views
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 통합을 작성하고 몇 가지 문제가 있습니다. 함수가이 "부모"를 반환하기 때문에 "부모"를 검사하면 문제가 해결 될 것이라고 생각합니다. 누구든지 이에 관한 정보가 있으면 공유하십시오. 감사!

답변

0

스토리 (HierarchicalRequirement) 개체가 할당됩니다. 인쇄 아래 Rally Ruby REST toolkit

코드를 사용 :

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를 기반으로 사용자 스토리를 찾으려면 다음 예를 참조하십시오. 이야기의 부모가 이야기이기 때문에 그것이 부모인지 아닌지는별로 중요하지 않습니다. 나는 스크립트에서 명확성을 위해 "부모"대신에 "이야기"를 사용했습니다. 형식화 된 ID는이 예제에서 명령 줄 인수로 입력됩니다. 내가 story = result.first을 사용하고, story=result을 사용하지 않았 음을 유의하십시오. 내 방법에서이 개체를 반환 할 때

enter image description here

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] = "[email protected]" 
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 
+0

, 나는이 오류 : {다음은 출력의 스크린 샷은 오류 => [ "\에서 객체 참조를 구문 분석 할 수 없습니다"등 \ ""], : warnings => [ "API 상태가 지원되지 않으며 2013 년 10 월 26 일에 지원되지 않습니다."]} 여기에서 코드를 공유하지 않았으므로 완전히 도움이 될지 확신 할 수 없습니다. 그러나 나는 많은 사람들이 특별히 Rally-Excel 플러그인을 사용하기 전에이 오류에 직면 해 있다고 생각한다. 혹시 잘못 될 수있는 것에 관해 나에게 뭔가 제안 해 줄 수 있니? –

+0

rally_api 또는 지원되지 않는 rally_rest_api를 사용하고 있습니까? 내 코드를 시험해보고 효과가 있는지 확인할 수 있습니까? 엑셀 플러그인과 루비에 대한 질문을 보지 못했습니다. – nickm

+0

코드가 작동하지만 기존 코드가 작동하지 않고 "개체 참조를 구문 분석 할 수 없음"오류가 발생합니다. 나는 그 문제를 이해할 수 없다. 오류의 의미를 아십니까? –