How do I use the Ruby facade to the Rally Rest API
628 Views, 5 Comments
| Title: | How do I use the Ruby facade to the Rally Rest API |
| Product: | Rally Enterprise |
| How To: | Rally has created a facade in Ruby to easily interact with the data in your subscription via the REST web services API. You can create, read, update, and delete via the Ruby REST API. Since Ruby is a very flexible and extensible language, we were able to make access to the object model extremely simple. For example, if you have a User Story called 'story', the following code iterates over the tasks. story.tasks.each { |task| print task.name } There is no need to make a separate call to fetch Tasks. When you follow domain model 'links' in the Ruby code, the Ruby REST API automatically loads in the necessary objects for you.
The source code and documentation are stored at RubyForge. http://rubyforge.org/projects/rally-rest-api/ To start using Ruby with Rally's REST API, please visit this post on Agile Commons for more information and example code: http://agilecommons.org/posts/20e3dee20a This link requires that you are a member of Agile Commons. Please visit the "Help & Training" page and then click on the "Community" tab in Rally to find out how to join Agile Commons and the Rally User Community. |
Rating: 0
it looks like the latest release of the api is broken
require 'rubygems'
require 'rally_rest_api'
# Test
# 'Login to the Rally App'
slm = RallyRestAPI.new(:base_url => "https://rally1.rallydev.com/slm",
:username => "my user name",
:password => "my password",
:project => "my project",
:workspace => "my workspace")
# Find an iteration by name
@results = slm.find_all(:iteration)
puts @results
@results.each do |@result|
puts @result.name
end
does not print anything......
Stanislav, There are a couple minor issues with the code
1) I am pretty sure the RallyRestAPI.new call does not accept the project and workspace parameters. You can see the params here: http://rally-rest-api.rubyforge.org/getting-started.html. When the RallyRestAPI connects, it will go to your default workspace and project (or choose one for you if you have not).
2) Also, not exactly sure about the block params and whether they will work without braces.
3) Lastly, your code comments says find iteration by name, but you are finding all of them. Not sure if that is your intent.
Please try this...
require 'rubygems'
require 'rally_rest_api'
# Test
# 'Login to the Rally App'
slm = RallyRestAPI.new(
:username => "my user name",
:password => "my password")
# Find an iteration by name
@results = slm.find_all(:iteration)
puts @results
@results.each do { |result|
puts result.name
}
Please let me know if that works.
This is all new to me so please bare with my questions.
I installed the Ruby Gems package manager, I installed the Rdoc server and it appears to be running. Do I run the code snippets in the interactive Ruby console from the command line ?
Where should I see results, in the console ? I guess I'm still trying to connect the dots
How do I find out the variable for exporting the subscription admin TRUE FALSE field out of the Rally users screen. I have a full report running perfect, showing username, and other info but I need to capture that subscription admin True False. Can anyone help?
Hi Joe, unfortunately this field isn't visible through web services at this time. I would recommend cross posting this as a feature request under http://agilecommons.org/hives/4b79034e53/summary for other users to vote up as well.