Browse files

Updated to latest version of SDK

  • Loading branch information...
1 parent 7d203a4 commit fa3a5715fd399f1e54608bd747117c9f9a615d6b @rodsimpson rodsimpson committed Aug 17, 2012
Showing with 41 additions and 38 deletions.
  1. +3 −3 index.html
  2. +38 −35 js/usergrid.appSDK.js
View
6 index.html
@@ -39,7 +39,7 @@
<a href="#login" id="btn-login" data-role="button">Login</a>
</div>
<div style="width: 50%; float: right">
- <a href="#page-new-account" id="btn-show-create-new-account" data-role="button" data-role="button" data-rel="dialog" data-transition="pop">New Account</a>
+ <a href="#page-new-account" id="btn-show-create-new-account" data-role="button" data-rel="dialog" data-transition="pop">New Account</a>
</div>
</div>
<div data-role="footer" data-position="fixed">
@@ -80,7 +80,7 @@
<div data-role="content">
<div id="user-message-update-account"></div>
<p>Account Info</p>
- <form name="form-create-new-account" id="form-create-new-account">
+ <form name="form-update-new-account" id="form-update-new-account">
<label for="update-name">Name</label>
<input type="text" name="update-name" id="update-name" class="span4" />
<label for="update-email">Email</label>
@@ -145,7 +145,7 @@
<button id="post-message">Post</button>
</div>
<div style="width: 50%; float: right">
- <a href="#page-messages-list" id="btn-close-update-account-page" data-role="button">Cancel</a>
+ <a href="#page-messages-list" id="btn-close-new-message" data-role="button">Cancel</a>
</div>
</div>
</div>
View
73 js/usergrid.appSDK.js
@@ -25,7 +25,7 @@ window.console.log = window.console.log || function() {};
//Usergrid namespace encapsulates this SDK
window.Usergrid = window.Usergrid || {};
Usergrid = Usergrid || {};
-Usergrid.SDK_VERSION = '0.9.5';
+Usergrid.SDK_VERSION = '0.9.6';
/**
* Usergrid.Query is a class for holding all query information and paging state
@@ -45,10 +45,10 @@ Usergrid.SDK_VERSION = '0.9.5';
* @param {function} successCallback
* @param {function} failureCallback
*/
- Usergrid.Query = function(method, path, jsonObj, paramsObj, successCallback, failureCallback) {
+ Usergrid.Query = function(method, resource, jsonObj, paramsObj, successCallback, failureCallback) {
//query vars
this._method = method;
- this._path = path;
+ this._resource = resource;
this._jsonObj = jsonObj;
this._paramsObj = paramsObj;
this._successCallback = successCallback;
@@ -81,7 +81,7 @@ Usergrid.SDK_VERSION = '0.9.5';
try {
seconds = ((time/10) / 60).toFixed(2);
} catch(e){ return 0; }
- return this.getMethod() + " " + this.getPath() + " - " + seconds + " seconds";
+ return this.getMethod() + " " + this.getResource() + " - " + seconds + " seconds";
},
/**
* A method to set all settable parameters of the Query at one time
@@ -96,9 +96,9 @@ Usergrid.SDK_VERSION = '0.9.5';
* @param {function} failureCallback
* @return none
*/
- setAllQueryParams: function(method, path, jsonObj, paramsObj, successCallback, failureCallback) {
+ setAllQueryParams: function(method, resource, jsonObj, paramsObj, successCallback, failureCallback) {
this._method = method;
- this._path = path;
+ this._resource = resource;
this._jsonObj = jsonObj;
this._paramsObj = paramsObj;
this._successCallback = successCallback;
@@ -113,7 +113,7 @@ Usergrid.SDK_VERSION = '0.9.5';
*/
clearAll: function() {
this._method = null;
- this._path = null;
+ this._resource = null;
this._jsonObj = {};
this._paramsObj = {};
this._successCallback = null;
@@ -142,25 +142,25 @@ Usergrid.SDK_VERSION = '0.9.5';
},
/**
- * Returns the path
+ * Returns the resource
*
* @public
- * @method getPath
- * @return {string} Returns path
+ * @method getResource
+ * @return {string} the resource
*/
- getPath: function() {
- return this._path;
+ getResource: function() {
+ return this._resource;
},
/**
- * sets the path
+ * sets the resource
*
* @public
- * @method setPath
+ * @method setResource
* @return none
*/
- setPath: function(path) {
- this._path = path;
+ setResource: function(resource) {
+ this._resource = resource;
},
/**
@@ -477,7 +477,7 @@ Usergrid.SDK_VERSION = '0.9.5';
* adds a specific field or object to the Entity's data
*
* @method set
- * @param {string} item || {object}
+ * @param {string} item || {object}
* @param {string} value
* @return none
*/
@@ -695,8 +695,8 @@ Usergrid.SDK_VERSION = '0.9.5';
* @param {string} collectionPath - the type of collection to model
* @param {uuid} uuid - (optional), the UUID of the collection if it is known
*/
- Usergrid.Collection = function(collectionPath, uuid) {
- this._collectionPath = collectionPath;
+ Usergrid.Collection = function(path, uuid) {
+ this._path = path;
this._uuid = uuid;
this._list = [];
this._Query = new Usergrid.Query();
@@ -708,22 +708,22 @@ Usergrid.SDK_VERSION = '0.9.5';
/**
* gets the current Collection path
*
- * @method getCollectionPath
- * @return {string} collectionPath
+ * @method getPath
+ * @return {string} path
*/
- Usergrid.Collection.prototype.getCollectionPath = function (){
- return this._collectionPath;
+ Usergrid.Collection.prototype.getPath = function (){
+ return this._path;
}
/**
- * sets the current Collection path
+ * sets the Collection path
*
- * @method setCollectionPath
- * @param {string} collectionPath
+ * @method setPath
+ * @param {string} path
* @return none
*/
- Usergrid.Collection.prototype.setCollectionPath = function (collectionPath){
- this._collectionPath = collectionPath;
+ Usergrid.Collection.prototype.setPath = function (path){
+ this._path = path;
}
/**
@@ -751,6 +751,8 @@ Usergrid.SDK_VERSION = '0.9.5';
*
* @method addEntity
* @param {object} entity
+ * @param {function} successCallback
+ * @param {function} errorCallback
* @return none
*/
Usergrid.Collection.prototype.addEntity = function (entity){
@@ -762,14 +764,15 @@ Usergrid.SDK_VERSION = '0.9.5';
/**
* Adds a new Entity to the collection (saves, then adds to the local object)
*
- * @method addEntity
+ * @method addNewEntity
* @param {object} entity
* @return none
*/
- Usergrid.Collection.prototype.addNewEntity = function (entity) {
- //save the entity
- entity.save();
+ Usergrid.Collection.prototype.addNewEntity = function (entity,successCallback, errorCallback) {
+ //add the entity to the list
this.addEntity(entity);
+ //then save the entity
+ entity.save(successCallback, errorCallback);
}
Usergrid.Collection.prototype.destroyEntity = function (entity) {
@@ -1246,7 +1249,7 @@ Usergrid.ApiClient = (function () {
/*
* A public method to set the application name to be used by the client
- *
+ *
* @method setApplicationName
* @public
* @param appName - the application name
@@ -1529,7 +1532,7 @@ Usergrid.ApiClient = (function () {
Query.setQueryStartTime();
//peel the data out of the query object
var method = Query.getMethod().toUpperCase();
- var path = Query.getPath();
+ var path = Query.getResource();
var jsonObj = Query.getJsonObj() || {};
var params = Query.getQueryParams() || {};
@@ -1975,7 +1978,7 @@ Usergrid.validation = (function () {
/**
* Tests if the string is a uuid
- *
+ *
* @public
* @method isUUID
* @param {string} uuid The string to test

0 comments on commit fa3a571

Please sign in to comment.