diff --git a/lib/Parse.js b/lib/Parse.js index 18f6d40..f6dea3d 100644 --- a/lib/Parse.js +++ b/lib/Parse.js @@ -34,6 +34,13 @@ Parse.prototype = { parseRequest.call(this, 'POST', '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/1/users/', data, callback); }, + findWithObjectId: function (className, objectId, callback){ + var url = '/1/' + (className === '_User' ? 'users' : 'classes/' + className + '/' + objectId); + + + parseRequest.call(this, 'GET', url, null, callback); + + }, // get an object from the class store find: function (className, query, callback) { var url = '/1/' + (className === '_User' ? 'users' : 'classes/' + className); @@ -52,7 +59,7 @@ Parse.prototype = { // check to see if there is a 'where' object in the query object // the 'where' object need to be stringified by JSON.stringify(), not querystring if ( query.hasOwnProperty('where') ) { - url += '?where=' + encodeURIComponent(JSON.stringify(query.where)); + url += '?where=' + encodeURIComponent(JSON.stringify(query.where)); delete query.where; } @@ -347,7 +354,13 @@ Parse.prototype = { sendPush: function (data, callback) { parseRequest.call(this, 'POST', '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/1/push/', data, callback); + }, + + getCurrentSession: function(objectId, callback) + { + parseRequest.call(this, 'GET', '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/1/sessions/'+ objectId, callback); } + }; // Parse.com https api request @@ -395,7 +408,7 @@ function parseRequest(method, path, data, callback, contentType, sessionToken) { } var options = { - host: this._api_host, + hostname: this._api_host, port: this._api_port, headers: headers, path: path,