UNPKG

gamerocket

Version:

Gamerocket NodeJS Client Library

42 lines (28 loc) 1.53 kB
(function() { var Config, Gateway, Purchase, PurchaseGateway, __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; Purchase = require("./purchase").Purchase; Config = require("./config").Config; PurchaseGateway = (function(_super) { __extends(PurchaseGateway, _super); function PurchaseGateway(gateway) { this.gateway = gateway; } PurchaseGateway.prototype.find = function(id, callback) { return this.gateway.http.get("/games/" + this.gateway.config.apiKey + "/purchases/" + id, this.responseHandlerPurchase(callback)); }; PurchaseGateway.prototype.buy = function(id, attributes, callback) { return this.gateway.http.post("/games/" + this.gateway.config.apiKey + "/purchases/" + id + "/buy", attributes, this.responseHandler(callback)); }; PurchaseGateway.prototype.responseHandler = function(callback) { return this.createResponseHandler("data", Object, callback); }; PurchaseGateway.prototype.responseHandlerPurchase = function(callback) { return this.createResponseHandler("purchase", Purchase, callback); }; return PurchaseGateway; })(Gateway); exports.PurchaseGateway = PurchaseGateway; }).call(this);