Unverified Commit 586c1f1e authored by zeynel's avatar zeynel Committed by GitHub

Merge pull request #18 from jwilm/fix-edit-device

Fix bug with several endpoints not including app_id
parents 0168b473 13c486cc
......@@ -276,6 +276,9 @@ Client.prototype.editDevice = function (deviceId, body, callback) {
if (!this.app) {
throw 'You must define an "app" object.'
}
if (!('app_id' in body)) {
body.app_id = this.app.appId;
}
return basicRequest(this.API_URI + constants.DEVICES_PATH + '/' + deviceId, this.app.appAuthKey, 'PUT', body, callback);
};
......@@ -319,6 +322,9 @@ Client.prototype.newSession = function (playerId, body, callback) {
if (!this.app) {
throw 'You must define an "app" object.'
}
if (!('app_id' in body)) {
body.app_id = this.app.appId;
}
var requestUri = this.API_URI + constants.DEVICES_PATH + '/' + playerId + '/on_session';
return basicRequest(requestUri, this.app.appAuthKey, 'POST', body, callback);
};
......@@ -334,6 +340,9 @@ Client.prototype.newPurchase = function (playerId, body, callback) {
if (!this.app) {
throw 'You must define an "app" object.'
}
if (!('app_id' in body)) {
body.app_id = this.app.appId;
}
var requestUri = this.API_URI + constants.DEVICES_PATH + '/' + playerId + '/on_purchase';
return basicRequest(requestUri, this.app.appAuthKey, 'POST', body, callback);
};
......@@ -349,6 +358,9 @@ Client.prototype.incrementSessionLength = function (playerId, body, callback) {
if (!this.app) {
throw 'You must define an "app" object.'
}
if (!('app_id' in body)) {
body.app_id = this.app.appId;
}
var requestUri = this.API_URI + constants.DEVICES_PATH + '/' + playerId + '/on_focus';
return basicRequest(requestUri, this.app.appAuthKey, 'POST', body, callback);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment