Building Apps in Multiple
OpenSocial Platforms

Matt Null

Web Developer

Building Apps in Multiple
OpenSocial Platforms

The problem.

Implementations of OpenSocial are not consistent
across platforms.

Features are not consistent
across platforms

 JiveSAPiGoogle
osapi.people.get() X    
groups X    
canvas view X   X
osapi.activities X X X

Writing an app that works across
multiple platforms

The Solution:

  • Find out what is consistent across platforms.
  • Write a base class containing consistent features.
  • Write sub-classes for platform specific features.

The Code

Base Class Example

var MyBaseGadget = function(params){
this.platform = params.platform;
if(params.platform == 'jive'){
this.jive = new JiveFeatures();
}
else if(params.platform == 'google'){
this.google = new GoogleFeatures();
}
};
MyBaseGadget.prototype.getPeople = function(){
if(this.platform == 'jive'){
this.jive.getPeople();
}
else if(this.platform == 'google'){
this.google.getPeople();
}
};
...

The Code

Sub Class Example

var GoogleFeatures = function(params){
//if we need to reference the base class
this.basegadget = BASE_WIDGET_INSTANCE;
};
GoogleFeatures.prototype.getPeople = function(){
//get people using v0.8
var req = opensocial.newDataRequest();

req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER), 'viewer');

var viewerFriends = opensocial.newIdSpec({ "userId" : "VIEWER", "groupId" : "FRIENDS" });

req.add(req.newFetchPeopleRequest(viewerFriends, params), 'viewerFriends');
req.send();
};
...

SurveyGizmo Platform

  • SurveyGizmo as an OpenSocial container
  • More collaborative experience
  • Beneficial to large companies with multiple users

End.

Matt Null / matt@sgizmo.com

@surveygizmo / developer.surveygizmo.com

@boulderux / boulderux.com