You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by do...@apache.org on 2008/07/14 22:23:20 UTC

svn commit: r676720 - /incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js

Author: doll
Date: Mon Jul 14 13:23:19 2008
New Revision: 676720

URL: http://svn.apache.org/viewvc?rev=676720&view=rev
Log:
Refactored the getFieldsList method to be a little more intuitive. 


Modified:
    incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js

Modified: incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js?rev=676720&r1=676719&r2=676720&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js (original)
+++ incubator/shindig/trunk/features/opensocial-current/restfulcontainer.js Mon Jul 14 13:23:19 2008
@@ -256,18 +256,26 @@
 
 RestfulContainer.prototype.createPersonFromJson = function(serverJson) {
   return new JsonPerson(serverJson);
-}
+};
 
 RestfulContainer.prototype.getFieldsList = function(keys) {
   // datarequest.js guarantees that keys is an array
-  if (!keys || keys.length == 0 || keys[0] == "*") {
-    // Some containers support * to mean all keys in the js apis.
-    // This allows the RESTful apis to be compatible with them.
+  if (this.hasNoKeys(keys) || this.isWildcardKey(keys[0])) {
     return '';
   } else {
     return 'fields=' + keys.join(',');
   }
-}
+};
+
+RestfulContainer.prototype.hasNoKeys = function(keys) {
+  return !keys || keys.length == 0;
+};
+
+RestfulContainer.prototype.isWildcardKey = function(key) {
+  // Some containers support * to mean all keys in the js apis.
+  // This allows the RESTful apis to be compatible with them.
+  return key == "*";
+};
 
 RestfulContainer.prototype.newFetchPersonAppDataRequest = function(idSpec,
     keys) {