node-parse-api
Advanced tools
Comparing version 0.3.2 to 0.3.4
@@ -80,2 +80,7 @@ var qs = require('querystring'); | ||
// run cloud function | ||
cloudRun: function (functionName, params, callback) { | ||
parseRequest.call(this, 'POST', '/1/functions/' + functionName, params, callback); | ||
}, | ||
// update a User object's email address | ||
@@ -317,15 +322,2 @@ updateUserEmail: function(objectId, data, callback) { | ||
if (res.statusCode < 200 || res.statusCode >= 300) { | ||
var err = new Error('HTTP error ' + res.statusCode); | ||
err.arguments = arguments; | ||
err.type = res.statusCode; | ||
err.options = options; | ||
err.body = body; | ||
return callback(err); | ||
} | ||
// if ((!err) && (res.statusCode === 200 || res.statusCode === 201)) { | ||
// res.success = res.statusCode; | ||
// } | ||
var json = ''; | ||
@@ -339,9 +331,23 @@ res.setEncoding('utf8'); | ||
res.on('end', function () { | ||
var err = null; | ||
var data = null; | ||
try { | ||
var data = reformatDatesFromParse(JSON.parse(json)); | ||
data = reformatDatesFromParse(JSON.parse(json)); | ||
} catch (err) { | ||
return callback(err); | ||
} | ||
callback(err, data); | ||
if (res.statusCode < 200 || res.statusCode >= 300) { | ||
var message = data.error ? data.error + ' (Code: ' + data.code + ')' : | ||
'HTTP error' + res.statusCode; | ||
var err = new Error(message); | ||
err.code = data.code; | ||
err.arguments = arguments; | ||
err.type = res.statusCode; | ||
err.options = options; | ||
err.body = body; | ||
return callback(err); | ||
} | ||
callback(null, data); | ||
}); | ||
@@ -348,0 +354,0 @@ |
{ | ||
"name": "node-parse-api", | ||
"description": "A Parse.com REST API client for Node.js", | ||
"version": "0.3.2", | ||
"version": "0.3.4", | ||
"author": "Chris Johnson <tenorviol@yahoo.com>, Michael Leveton <mleveton@prepcloud.com>, Seth Gholson", | ||
"repository": "git://github.com/leveton/node-parse-api", | ||
"contributors": [ | ||
"Seth Gholson", | ||
"Daniel Gasienica <daniel@gasienica.ch>" | ||
], | ||
"main": "index", | ||
"scripts":{ | ||
"test":"nodeunit" | ||
"scripts": { | ||
"test": "nodeunit" | ||
}, | ||
"repository": "https://github.com/leveton/node-parse-api", | ||
"keywords": [ | ||
"parse", | ||
"mbaas", | ||
"rest", | ||
"push notifications", | ||
"api" | ||
], | ||
"engines": { | ||
@@ -12,0 +23,0 @@ "node": ">= 0.4.0" |
@@ -128,1 +128,15 @@ var Parse = require('../index').Parse; | ||
} | ||
exports['push notification error'] = function (assert) { | ||
parse.sendPush({ | ||
channels: ['foobar'], | ||
data2: { | ||
alert: 'test message' | ||
} | ||
}, function (error, result) { | ||
assert.ok(error); | ||
assert.equal(result, null); | ||
assert.equal(error.message, 'Missing the push data. (Code: 115)'); | ||
assert.done(); | ||
}); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23894
434