The ELC Community Blog
A knowledge exchange on Ruby on Rails and Agile Development
Ruby on Rails, OpenSocial Container plugin 0.1.0
by Ryan Garver on November 29, 2007
As promised the opensocial_container 0.1.0 is here! This is still very very young. But it supports some basic persistence and people profile requests and starts down the path of implementing the REST API. If you are already implementing the REST API on your own, the implementation of the OpenSocial Javascript API that I'm working on is designed to play nicely with that (the docs are not strict on that matter as it turns out).
My goal is to get a 1.0 release out soon. To do that the plugin must support the full 0.5 version of the opensocial JS API. It still have a bit to go, but so far the progress is accelerating, which is very good. Expect a few more minor version releases as I expand the API support.
To install:ruby script/plugin install http://opensocial.rubyforge.org/svn/plugin/tags/0_1_0/opensocial_container
Notice: This is very new, and in many ways broken. By default there isn't much in the way of security in place with the generators so don't put any data in the system if you expect it to be private.
OpensocialContainer
===================
This plugin is designed to pull together all of the neccessary components involved in turning your application in to an OpenSocial container capable of hosting OpenSocial applications. Beyond the raw functionality this plugin is being built to make the practice of presenting a secure and stable container simple and straightforward by adopting best practices as they are defined.
Reference Links
===============
http://code.google.com/apis/opensocial/
http://code.google.com/apis/gadgets/
Example
=======
In the config/routes.rb file:
ActionController::Routing::Routes.draw do |map|
...
map.opensocial_container :contain
end
To add the "feeds" resources:
ruby script/generator opensocial
If you support the OpenSocial REST API already, then use this instead to avoid the pollution:
ruby script/generator opensocial_assets
And finally to embed the container in a ERb template use the helper:
<%= opensocial_container('http://www.last.fm/opensocial/myfavouritemusic.xml') %>
In the config/environment.rb you need to add
OpenSocialContainer::Configuration.person_class = 'User'
to get the support for people to be your "User" class. The user needs to have:
def self.opensocial_id_column_name; 'id'; end
and should define a title:
def title; self.display_name; end
Caveats
=======
This plugin is in very early development and should be used with that in mind. While hopefully not too buggy, it may be feature lacking in a number of respects.
Copyright (c) 2007 ELC Technologies, released under the MIT license
See Also: Release 0.0.1
Timeline
- acts_as_chattable: make web chatting easy
- OpenSocial Container 0.3.0
- OpenSocial Container 0.2.0
- Mephisto Flickr AJAX Loader
- OpenSocial? What's that?
- Ruby on Rails, OpenSocial Container plugin 0.1.0
- Ruby on Rails primer for Java developers
- OpenSocial container plugin 0.0.1
- Ultraviolet syntax highlighting in Mephisto
- Creating new generator commands
- Testing Libraries
Comments
Excellent, would you consider commiting it to the apache shindig project, where we will try to have one implementation of an opensocial container per language?
Thanks for the pointer Patrick. I’ll take a look at that.
this is good