diff --git a/README.md b/README.md index 43afc31..81877cc 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ A hubot script to get google analytics reports -See [`src/analytics.coffee`](src/analytics.coffee) for full documentation. +See [`src/analytics.js`](src/analytics.js) for full documentation. ## Installation @@ -24,6 +24,9 @@ Then add **hubot-analytics** to your `external-scripts.json`: ## Sample Interaction ``` -user1>> hubot hello -hubot>> hello! +User>> SpikeBot analytics profiles +SpikeBot>> @User: +114783908 - Project X +123511123 - Site Plan B +128210353 - Hubot Chat ``` diff --git a/src/analytics.js b/src/analytics.js index 5ed4691..ddd484c 100644 --- a/src/analytics.js +++ b/src/analytics.js @@ -18,7 +18,7 @@ var google = require("googleapis"); var analytics = google.analytics("v3"); var GOOGLE_API_CLIENT_EMAIL = process.env.GOOGLE_API_CLIENT_EMAIL; -var GOOGLE_API_PRIVATE_KEY = process.env.GOOGLE_API_PRIVATE_KEY.replace(/\\n/g, '\n'); +var GOOGLE_API_PRIVATE_KEY = process.env.GOOGLE_API_PRIVATE_KEY.replace(/\\n/g, "\n"); var oauth2Client = new google.auth.JWT(GOOGLE_API_CLIENT_EMAIL, null, GOOGLE_API_PRIVATE_KEY, ["https://www.googleapis.com/auth/analytics.readonly"], null); @@ -39,7 +39,6 @@ module.exports = function(robot) { }, function(err, entries) { if (err) { - console.log(err); return res.reply(err); } diff --git a/test/analytics-test.js b/test/analytics-test.js index be4bfb7..e06f4e1 100644 --- a/test/analytics-test.js +++ b/test/analytics-test.js @@ -8,13 +8,13 @@ chai.use(require("sinon-chai")); expect = chai.expect; -describe('analytics', function() { +describe("analytics", function() { beforeEach(function() { this.robot = { respond: sinon.spy(), hear: sinon.spy() }; - return require('../src/analytics')(this.robot); + return require("../src/analytics")(this.robot); }); it("registers a respond listener", function() { return expect(this.robot.respond).to.have.been.calledWith(/hello/);