Rally Ruby toolkit: how to get URL of Portfolio Item's state? -
is there example in ruby using rally_api how set state of feature mentioned here?
specifically, there way query objectid or qualified path of state use
"state" => "developing" instead of
"state" => "/state/<objectid>"
it possible query state, create hash, , populate hash query results, state name key , state _ref value:
state_results.each |s| s.read state_hash[s["name"]] = s["_ref"] end then can update state:
features.each |f| field_updates={"state" => state_hash["developing"]} f.update(field_updates) end here code example:
@rally = rallyapi::rallyrestjson.new(config) querystate = rallyapi::rallyquery.new() querystate.type = :state querystate.fetch = "true" querystate.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/11111" } querystate.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/22222" } #use valid oids querystate.query_string = "(typedef.name = \"feature\")" state_hash = hash.new state_results = @rally.find(querystate) state_results.each |s| s.read #puts "ref: #{s["_ref"]}, name: #{s["name"] }, typedef: #{s["typedef"]}" state_hash[s["name"]] = s["_ref"] end query = rallyapi::rallyquery.new() query.type = "portfolioitem/feature" query.fetch = "name,formattedid" query.workspace = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1111" } query.project = {"_ref" => "https://rally1.rallydev.com/slm/webservice/v2.0/project/22222" } #use valid oids query.query_string = "(name = \"my feature\")" results = @rally.find(query) features = []; results.each |f| f.read puts "current state of feature #{f["formattedid"]}: #{f["state"].to_s}" features << f end features.each |f| field_updates={"state" => state_hash["developing"]} f.update(field_updates) puts "feature #{f["formattedid"]} in state: #{f["state"].to_s}" end
Comments
Post a Comment