{"action":"created","comment":{"url":"https://api.github.com/repos/DataEasy/slack-cutter/pulls/comments/45687623","id":45687623,"diff_hunk":"@@ -0,0 +1,33 @@\n+import google from 'googleapis';\n+import util from './util';\n+\n+let KEY;\n+util.readJsonFromFile('./google-service-api-json-key.json', data => {\n+    KEY = data;\n+});\n+\n+class GoogleAuth{\n+    constructor() {","path":"lib/google-auth.js","position":10,"original_position":10,"commit_id":"4748f5af65dd729a38a0dad666be3172d9f026e5","original_commit_id":"4748f5af65dd729a38a0dad666be3172d9f026e5","user":{"login":"cezar-carneiro","id":2872571,"avatar_url":"https://avatars.githubusercontent.com/u/2872571?v=3","gravatar_id":"","url":"https://api.github.com/users/cezar-carneiro","html_url":"https://github.com/cezar-carneiro","followers_url":"https://api.github.com/users/cezar-carneiro/followers","following_url":"https://api.github.com/users/cezar-carneiro/following{/other_user}","gists_url":"https://api.github.com/users/cezar-carneiro/gists{/gist_id}","starred_url":"https://api.github.com/users/cezar-carneiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cezar-carneiro/subscriptions","organizations_url":"https://api.github.com/users/cezar-carneiro/orgs","repos_url":"https://api.github.com/users/cezar-carneiro/repos","events_url":"https://api.github.com/users/cezar-carneiro/events{/privacy}","received_events_url":"https://api.github.com/users/cezar-carneiro/received_events","type":"User","site_admin":false},"body":"Well, I guess I should just remove it. thx","created_at":"2015-11-24T01:34:35Z","updated_at":"2015-11-24T01:34:35Z","html_url":"https://github.com/DataEasy/slack-cutter/pull/19#discussion_r45687623","pull_request_url":"https://api.github.com/repos/DataEasy/slack-cutter/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/DataEasy/slack-cutter/pulls/comments/45687623"},"html":{"href":"https://github.com/DataEasy/slack-cutter/pull/19#discussion_r45687623"},"pull_request":{"href":"https://api.github.com/repos/DataEasy/slack-cutter/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/DataEasy/slack-cutter/pulls/19","id":50810885,"html_url":"https://github.com/DataEasy/slack-cutter/pull/19","diff_url":"https://github.com/DataEasy/slack-cutter/pull/19.diff","patch_url":"https://github.com/DataEasy/slack-cutter/pull/19.patch","issue_url":"https://api.github.com/repos/DataEasy/slack-cutter/issues/19","number":19,"state":"open","locked":false,"title":"[WIP] Integration with google spreadsheets","user":{"login":"cezar-carneiro","id":2872571,"avatar_url":"https://avatars.githubusercontent.com/u/2872571?v=3","gravatar_id":"","url":"https://api.github.com/users/cezar-carneiro","html_url":"https://github.com/cezar-carneiro","followers_url":"https://api.github.com/users/cezar-carneiro/followers","following_url":"https://api.github.com/users/cezar-carneiro/following{/other_user}","gists_url":"https://api.github.com/users/cezar-carneiro/gists{/gist_id}","starred_url":"https://api.github.com/users/cezar-carneiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cezar-carneiro/subscriptions","organizations_url":"https://api.github.com/users/cezar-carneiro/orgs","repos_url":"https://api.github.com/users/cezar-carneiro/repos","events_url":"https://api.github.com/users/cezar-carneiro/events{/privacy}","received_events_url":"https://api.github.com/users/cezar-carneiro/received_events","type":"User","site_admin":false},"body":"* It is now possible to choose between two options of how the system will load the information about phone extensions: (1) load from a .json file located in the server or (2) connecting to a Google Spreadsheet. The setting should be made in the `.env` file, in the `EXT_MODE` parameter, choosing from `FILE` or `SHEET`. e.g.: `EXT_MODE=SHEET`.\r\n* The integration between the system and the Google API works like this: In the first request received by slack-cutter, the system authenticates within the Google API, loads the data from the spreadsheet specified in the file `google-spreadsheet-config.json` and caches the data in memory to answer future requests. If the spreadsheet is ever updated, a special request must be sent to slack-cutter so the system can reload the data from the spreadsheet and update the cached data. This special request can be made like this: `http://<ip>:<porta>/slashCommands/ext?command=/ramal&update=true`.\r\n* The behavior of the old method (.json file in the server) remains the same.\r\n* To authenticate within the Google API we need the file `google-service-api-json-key.json` with a couple of keys that can be obtained in the Developer's Dashboard of the Google's Account Configuration registering Slack-Cutter as client of the Google API. (wait for the documentation for these steps)\r\n\r\nI still haven't done any documentation of how the phone extensions must be disposed in the spreadsheet or how to register slack-cutter to the spreadsheet but it will be done soon. For now, I believe you guys can start reviewing the code. If you have any doubt, please talk to me. Thx.","created_at":"2015-11-16T13:39:42Z","updated_at":"2015-11-24T01:34:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ddf4eb06265828a548fdfc41437abefeca2309c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/DataEasy/slack-cutter/pulls/19/commits","review_comments_url":"https://api.github.com/repos/DataEasy/slack-cutter/pulls/19/comments","review_comment_url":"https://api.github.com/repos/DataEasy/slack-cutter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DataEasy/slack-cutter/issues/19/comments","statuses_url":"https://api.github.com/repos/DataEasy/slack-cutter/statuses/4748f5af65dd729a38a0dad666be3172d9f026e5","head":{"label":"cezar-carneiro:add_gdoc_integration_to_ext_command","ref":"add_gdoc_integration_to_ext_command","sha":"4748f5af65dd729a38a0dad666be3172d9f026e5","user":{"login":"cezar-carneiro","id":2872571,"avatar_url":"https://avatars.githubusercontent.com/u/2872571?v=3","gravatar_id":"","url":"https://api.github.com/users/cezar-carneiro","html_url":"https://github.com/cezar-carneiro","followers_url":"https://api.github.com/users/cezar-carneiro/followers","following_url":"https://api.github.com/users/cezar-carneiro/following{/other_user}","gists_url":"https://api.github.com/users/cezar-carneiro/gists{/gist_id}","starred_url":"https://api.github.com/users/cezar-carneiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cezar-carneiro/subscriptions","organizations_url":"https://api.github.com/users/cezar-carneiro/orgs","repos_url":"https://api.github.com/users/cezar-carneiro/repos","events_url":"https://api.github.com/users/cezar-carneiro/events{/privacy}","received_events_url":"https://api.github.com/users/cezar-carneiro/received_events","type":"User","site_admin":false},"repo":{"id":46274861,"name":"slack-cutter","full_name":"cezar-carneiro/slack-cutter","owner":{"login":"cezar-carneiro","id":2872571,"avatar_url":"https://avatars.githubusercontent.com/u/2872571?v=3","gravatar_id":"","url":"https://api.github.com/users/cezar-carneiro","html_url":"https://github.com/cezar-carneiro","followers_url":"https://api.github.com/users/cezar-carneiro/followers","following_url":"https://api.github.com/users/cezar-carneiro/following{/other_user}","gists_url":"https://api.github.com/users/cezar-carneiro/gists{/gist_id}","starred_url":"https://api.github.com/users/cezar-carneiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cezar-carneiro/subscriptions","organizations_url":"https://api.github.com/users/cezar-carneiro/orgs","repos_url":"https://api.github.com/users/cezar-carneiro/repos","events_url":"https://api.github.com/users/cezar-carneiro/events{/privacy}","received_events_url":"https://api.github.com/users/cezar-carneiro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cezar-carneiro/slack-cutter","description":"Cutting some Slack for you :)","fork":true,"url":"https://api.github.com/repos/cezar-carneiro/slack-cutter","forks_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/forks","keys_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/teams","hooks_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/hooks","issue_events_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/issues/events{/number}","events_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/events","assignees_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/assignees{/user}","branches_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/branches{/branch}","tags_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/tags","blobs_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/git/refs{/sha}","trees_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/statuses/{sha}","languages_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/languages","stargazers_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/stargazers","contributors_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/contributors","subscribers_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/subscribers","subscription_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/subscription","commits_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/commits{/sha}","git_commits_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/git/commits{/sha}","comments_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/comments{/number}","issue_comment_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/issues/comments{/number}","contents_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/contents/{+path}","compare_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/merges","archive_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/downloads","issues_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/issues{/number}","pulls_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/pulls{/number}","milestones_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/milestones{/number}","notifications_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/labels{/name}","releases_url":"https://api.github.com/repos/cezar-carneiro/slack-cutter/releases{/id}","created_at":"2015-11-16T13:02:06Z","updated_at":"2015-11-16T13:02:07Z","pushed_at":"2015-11-16T13:08:56Z","git_url":"git://github.com/cezar-carneiro/slack-cutter.git","ssh_url":"git@github.com:cezar-carneiro/slack-cutter.git","clone_url":"https://github.com/cezar-carneiro/slack-cutter.git","svn_url":"https://github.com/cezar-carneiro/slack-cutter","homepage":"","size":417,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"DataEasy:master","ref":"master","sha":"d7234b0fa0761c7b0a14976dce329b928a8314da","user":{"login":"DataEasy","id":8172319,"avatar_url":"https://avatars.githubusercontent.com/u/8172319?v=3","gravatar_id":"","url":"https://api.github.com/users/DataEasy","html_url":"https://github.com/DataEasy","followers_url":"https://api.github.com/users/DataEasy/followers","following_url":"https://api.github.com/users/DataEasy/following{/other_user}","gists_url":"https://api.github.com/users/DataEasy/gists{/gist_id}","starred_url":"https://api.github.com/users/DataEasy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataEasy/subscriptions","organizations_url":"https://api.github.com/users/DataEasy/orgs","repos_url":"https://api.github.com/users/DataEasy/repos","events_url":"https://api.github.com/users/DataEasy/events{/privacy}","received_events_url":"https://api.github.com/users/DataEasy/received_events","type":"Organization","site_admin":false},"repo":{"id":32389610,"name":"slack-cutter","full_name":"DataEasy/slack-cutter","owner":{"login":"DataEasy","id":8172319,"avatar_url":"https://avatars.githubusercontent.com/u/8172319?v=3","gravatar_id":"","url":"https://api.github.com/users/DataEasy","html_url":"https://github.com/DataEasy","followers_url":"https://api.github.com/users/DataEasy/followers","following_url":"https://api.github.com/users/DataEasy/following{/other_user}","gists_url":"https://api.github.com/users/DataEasy/gists{/gist_id}","starred_url":"https://api.github.com/users/DataEasy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataEasy/subscriptions","organizations_url":"https://api.github.com/users/DataEasy/orgs","repos_url":"https://api.github.com/users/DataEasy/repos","events_url":"https://api.github.com/users/DataEasy/events{/privacy}","received_events_url":"https://api.github.com/users/DataEasy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DataEasy/slack-cutter","description":"Cutting some Slack for you :)","fork":false,"url":"https://api.github.com/repos/DataEasy/slack-cutter","forks_url":"https://api.github.com/repos/DataEasy/slack-cutter/forks","keys_url":"https://api.github.com/repos/DataEasy/slack-cutter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataEasy/slack-cutter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataEasy/slack-cutter/teams","hooks_url":"https://api.github.com/repos/DataEasy/slack-cutter/hooks","issue_events_url":"https://api.github.com/repos/DataEasy/slack-cutter/issues/events{/number}","events_url":"https://api.github.com/repos/DataEasy/slack-cutter/events","assignees_url":"https://api.github.com/repos/DataEasy/slack-cutter/assignees{/user}","branches_url":"https://api.github.com/repos/DataEasy/slack-cutter/branches{/branch}","tags_url":"https://api.github.com/repos/DataEasy/slack-cutter/tags","blobs_url":"https://api.github.com/repos/DataEasy/slack-cutter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataEasy/slack-cutter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataEasy/slack-cutter/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataEasy/slack-cutter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataEasy/slack-cutter/statuses/{sha}","languages_url":"https://api.github.com/repos/DataEasy/slack-cutter/languages","stargazers_url":"https://api.github.com/repos/DataEasy/slack-cutter/stargazers","contributors_url":"https://api.github.com/repos/DataEasy/slack-cutter/contributors","subscribers_url":"https://api.github.com/repos/DataEasy/slack-cutter/subscribers","subscription_url":"https://api.github.com/repos/DataEasy/slack-cutter/subscription","commits_url":"https://api.github.com/repos/DataEasy/slack-cutter/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataEasy/slack-cutter/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataEasy/slack-cutter/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataEasy/slack-cutter/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataEasy/slack-cutter/contents/{+path}","compare_url":"https://api.github.com/repos/DataEasy/slack-cutter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataEasy/slack-cutter/merges","archive_url":"https://api.github.com/repos/DataEasy/slack-cutter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataEasy/slack-cutter/downloads","issues_url":"https://api.github.com/repos/DataEasy/slack-cutter/issues{/number}","pulls_url":"https://api.github.com/repos/DataEasy/slack-cutter/pulls{/number}","milestones_url":"https://api.github.com/repos/DataEasy/slack-cutter/milestones{/number}","notifications_url":"https://api.github.com/repos/DataEasy/slack-cutter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataEasy/slack-cutter/labels{/name}","releases_url":"https://api.github.com/repos/DataEasy/slack-cutter/releases{/id}","created_at":"2015-03-17T11:31:46Z","updated_at":"2015-10-08T00:59:27Z","pushed_at":"2015-11-20T18:14:41Z","git_url":"git://github.com/DataEasy/slack-cutter.git","ssh_url":"git@github.com:DataEasy/slack-cutter.git","clone_url":"https://github.com/DataEasy/slack-cutter.git","svn_url":"https://github.com/DataEasy/slack-cutter","homepage":"","size":179,"stargazers_count":44,"watchers_count":44,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":44,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/DataEasy/slack-cutter/pulls/19"},"html":{"href":"https://github.com/DataEasy/slack-cutter/pull/19"},"issue":{"href":"https://api.github.com/repos/DataEasy/slack-cutter/issues/19"},"comments":{"href":"https://api.github.com/repos/DataEasy/slack-cutter/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/DataEasy/slack-cutter/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/DataEasy/slack-cutter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DataEasy/slack-cutter/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/DataEasy/slack-cutter/statuses/4748f5af65dd729a38a0dad666be3172d9f026e5"}}}}