0
0
Fork 0
mirror of https://github.com/ENSL/ensl_gathers.git synced 2024-12-14 06:31:05 +00:00
ensl_gathers/lib/hive/client.js
2015-08-31 15:30:33 +01:00

30 lines
690 B
JavaScript

"use strict";
var path = require("path");
var request = require("request");
var logger = require("winston");
var querystring = require('querystring');
var config = require(path.join(__dirname, "../../config/config"));
function HiveClient (options) {
if (!(this instanceof HiveClient)) {
return new HiveClient(options);
}
this.baseUrl = config.hive_url;
}
HiveClient.prototype.getUserStats = (user, callback) => {
if (!user || !user.hive.id) {
return callback(new Error("Invalid user instance supplied"));
}
var id = user.hive.id;
var url = this.baseUrl + "api/get/playerData/" + id;
return request({
url: url,
json: true
}, callback);
};
module.exports = HiveClient;