gamerocket
Version:
Gamerocket NodeJS Client Library
42 lines (28 loc) • 1.49 kB
JavaScript
(function() {
var Action, ActionGateway, Config, Gateway,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
Gateway = require('./gateway').Gateway;
Action = require('./action').Action;
Config = require('./config').Config;
ActionGateway = (function(_super) {
__extends(ActionGateway, _super);
function ActionGateway(gateway) {
this.gateway = gateway;
}
ActionGateway.prototype.find = function(id, callback) {
return this.gateway.http.get("/games/" + this.gateway.config.apiKey + "/actions/" + id, this.responseHandlerAction(callback));
};
ActionGateway.prototype.run = function(id, attributes, callback) {
return this.gateway.http.post("/games/" + this.gateway.config.apiKey + "/actions/" + id + "/run", attributes, this.responseHandler(callback));
};
ActionGateway.prototype.responseHandler = function(callback) {
return this.createResponseHandler("data", Object, callback);
};
ActionGateway.prototype.responseHandlerAction = function(callback) {
return this.createResponseHandler("action", Action, callback);
};
return ActionGateway;
})(Gateway);
exports.ActionGateway = ActionGateway;
}).call(this);