GSoC Proposal - Active Resource Discovery


I submitted a proposal for the GSoC about adding a discovery file for
ActiveResource. This discovery file will allow developers to explore
(through an API) the resources that are available on a REST service. I
will also add a set of rake tasks for adding automatically generating
the REST clients.

This idea was originally posted on the rails GSoC wiki. Do any of you
guys have any ideas on anything else that can be made by adding a
discovery procedure to REST services?

Hi carlosk,

I really like the idea of being able to expose an API of REST services
automatically. Can you post your proposal here?

Here are some of my suggestions for things you can think about. Some
of them may be hit or miss. I imagine you could utilize something like
rake routes to generate possible services. However, I wonder how you
would handle before_filters that limit access to some services. For
example if a service required user credentials. Some other things to
consider would be the type of communication being used. Some services
may use any combination of xml, json, etc... Think about how you might
figure out which protocol is used for consumption and publication.
Also, what kind of information does the API require to be sent to it
for a particular service? The model might be a good place to look for
this, but it may not have all the information you need. Lastly, what
rules determine if a resource is included in the API? Is there some
place that you can restrict resources from being included in the API?

Thanks for the Reply Allen. I'll try to add some of your suggestions
to my proposal. This is the original proposal that I submitted:

Currently ActiveResource requires developers to know the domain of the
REST service. The only way of knowing if a resource is available is if
the service includes some documentation. This project will develop a
standard resource discovery procedure for Rails. With this new
standard developers will be able to add code that can dynamically work
with the resources exposed through REST. As an example set of rake
tasks for generating REST client classes would be created.


About Me:
My name is Carlos Kirkconnell and I'm a Fulbright Scholar from
Honduras. I'm currently getting a Master in Software Engineering at
Kansas State University. I made my undergrad degree in Honduras and I
studied Computer Science. After graduating, I worked both as a
university professor and as project manager. I developed software for
around 5 years.

Most of my work on the industry was done using the .net Framework.
With every successive release of the .net framework, I saw how things
were getting more complex and I completely disliked how Visual Studio
encourages developers to write bad code.

Around 2 and a half years ago, I heard about a new framework called
rails. I investigated about it and I fell in love with it. The code
was so clean! Design patterns were encouraged! I finally felt I was
really working on an MVC pattern. Database migrations turned to be the
final solution for the constant headache we were experiencing at my
job. I adapted a rails project to one of our .net solutions, and used
migrations to keep multiple databases up to date. This implementation
was a success. I've been using rails since that then.

I quitted my job after I got the Fulbright scholarship. Currently on
my spare time I'm working a web application that integrates with

Why do you use Rails? How would you like to see it improve?

Rails is the best framework that I've ever used for developing web
applications. I like the freedom that a dynamic language like ruby
gives me. That combined with rails turns developing web applications a
fun experience.

One thing about rails that I would like to see improve is the process
of communicating with other apps. The default approach requires the
coder to know the names and structures of all the resources published
by a web site. I believe that a more streamlined approach could be
made in order to ease the job of developers that want to communicate
through REST between web apps.

Why is this important to the Rails community at large? Why is this
important to you?

This project is important for the Rails community for two reasons:

It will allow developers to explore the resources available through
REST and, in most cases, without needing any special documentation
about the resources, information about the resources would be
Developers would be able to automate the creation of REST client
classes by using a rake task, reducing the amount of code required to
This change will allow applications to be able to dynamically
"explore" websites searching for resources.

This project is important for me because, for my graduation project,
my research area is going to be distributed web application. This
project will be a great experience for my research area.

List a clear set of goals/milestones you'll hit during the summer. Be

For this project I pretend to accomplish the following milestones:

Discovery File for REST: My first goal would be to use the
information found in the routes.rb file to generate either an XRDS
file ( or an RDF file (http:// I would
probably have to discuss with my mentor what's the best option.
Discovery API: After creating the Discovery File, I would create an
API that will read that information and present it to developers as a
useful data structure that could be explored.
Rake Tasks: Finally I will create rake tasks for both automating the
creation of ActiveResource client classes and to inform developers
about the resources found on REST server.
Namespaces for ActiveResource: Since the names of the resources on
other sites might conflict with the classes of your domain, I will
need to assign the REST clients to a namespace.

Give a rough timeline for hitting these milestones.

Discovery File for REST: June 12
Discovery API: July 3
Rake Tasks: July 30
Namespaces: Aug 7
Wrapping Everything Up: Aug 21

How will you measure progress? How will you handle falling behind?

I will use basecamp to keep track of my milestones. In the event of
falling behind I will talk to my mentor to find the best solution to
solve the problem that is stopping me.

What are the "unknowns" in this project for you? What kind of pitfalls
could you run into?

I've never made a rails plugins, but I know there are tons of
tutorials out there about how to make one. Another challenge might be
how to read the routes.rb file. I would need to investigate about how
routes work internally in rails.

Hey Carlos,

I'm currently doing a school project where we are creating two rails
applications that are going to talk to each other. When I was
researching some stuff I found some basic auth stuff that was build
into rails. I think this is a very viable way to handle authentication
when requesting protected resources. You may already know about this,
but here are some links that explain it better:

The comments here are useful
Simple step by step video on how to set it up for a controller

XRDS is in the process of being obsoleted, to be replaced with XRD.
Although the spec is not complete, new applications would be well
served by moving to XRD. It's been blogged extensively here: