Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change README with correct sample #4

Merged
merged 1 commit into from
Apr 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
```
3 changes: 1 addition & 2 deletions src/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -39,7 +39,6 @@ module.exports = function(robot) {
},
function(err, entries) {
if (err) {
console.log(err);
return res.reply(err);
}

Expand Down
4 changes: 2 additions & 2 deletions test/analytics-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/);
Expand Down