特定のユーザーのチーム メンバーシップを更新しようとしています。はからTeamMemberships
の変更可能なコレクションでUser
あるため、コードでそれを利用しようとしています。
def build_query(type,fetch,project_ref,string)
query = RallyAPI::RallyQuery.new()
query.type = type
query.fetch=fetch
query.query_string=string
result = @rally.find(query)
return result
end
def start
@projectName = "Rohan-test"
username = "Rohan Dalvi"
currentTeamMembership = get_current_team_membership("Rohan Dalvi")
puts "Current Team Membership: #{currentTeamMembership.inspect}"
current = currentTeamMembership.first
puts current["TeamMemberships"]
h_array = Array.new
h = {}
h["TeamMemberships"] = current["TeamMemberships"]
h["_ref"] = "/project/#{get_project_ref}"
h_array.push(current["TeamMemberships"])
h_array.push(h["_ref"])
final = {}
final["TeamMemberships"] = h_array
@rally.update("user",current["_ref"],final)
puts "Done"
#newTeam["_ref"] = get_project_ref
end
def get_current_team_membership(displayname)
#get current team membership for a user
result = build_query("User","DisplayName,TeamMemberships","","(DisplayName = \"#{displayname}\")")
if(result.length!=0)
return result
else
puts "There was some problem getting team membership for this user"
end
end
def get_project_ref
result = build_query("Project","Name,Description,ObjectID","","(Name = \"#{@projectName}\")")
puts result.inspect
if(result.length==1)
project = result.first
return project["ObjectID"]
else
puts "There was some problem getting the project"
end
end
start
次のようなエラーが表示されます。
Error on request - https://rally1.rallydev.com/slm/webservice/v2.0/user/13843362286 -
{:errors=>["Not authorized to perform action: Invalid key"], :warnings=>[]}
使用中に更新用のハッシュを送信する方法に何か問題があり@rally.update()
ますか?