{"action":"created","comment":{"url":"https://api.github.com/repos/openT2T/translators/pulls/comments/67258736","id":67258736,"diff_hunk":"@@ -0,0 +1,169 @@\n+'use strict';\n+\n+//var request = require('request');\n+var https = require('https');\n+var q = require('q');\n+\n+//this is our base, we each call has its own set of options\n+ var options = \n+ {\n+        protocol: 'https:',\n+        host: 'api.wink.com'     \n+ };\n+    \n+var  accessToken;  //we will need this when creating the headers\n+      \n+module.exports = \n+{\n+    //get the initial parameters to build our target endpoint\n+   initWinkApi: function(apiEndpoint, deviceID, token)\n+   {\n+       options.path = '/' + apiEndpoint + '/' + deviceID;\n+       accessToken = token; //the specific token\n+        \n+   },\n+ \n+   sendDesiredStateCommand: function(apiField,value,callback) \n+   {\n+       \n+    //build our desired state object where the apiField is the target value\n+    options.postData = {'desired_state':{}};\n+    options.postData.desired_state[apiField] = value;\n+    \n+    var deferred = q.defer();   // q will help us with returning a promise\n+    \n+    //the headers to make our call\n+    options.headers = \n+    {\n+        'Authorization': 'Bearer ' + accessToken,\n+        'Content-Type': 'application/json',\n+        'Accept': 'application/json',\n+        'Content-length':  JSON.stringify(options.postData).length\n+    }\n+    \n+    options.method = 'PUT'; //the type of request to make\n+   \n+    //our HTTPS call \n+    var req = https.request(options, (res) => {\n+        res.setEncoding('utf8');\n+        res.on('data', (chunk) => \n+        {\n+             deferred.resolve('The ' + apiField + ' changed to ' + value);\n+        });\n+        res.on('end', () => \n+        {\n+             deferred.resolve('ended call');\n+        });\n+        res.on('error', (e) => {\n+            deferred.reject(e.message);\n+        }); });\n+\n+    req.on('error', (e) => {\n+        console.log('problem with request:');\n+        deferred.reject(e.message);","path":"org.OpenT2T.Sample.SuperPopular.Helpers/js/index.js","position":63,"original_position":63,"commit_id":"335fe1672a81f4774eb443a62775fd33e4f9f8a5","original_commit_id":"335fe1672a81f4774eb443a62775fd33e4f9f8a5","user":{"login":"jasongin","id":13093042,"avatar_url":"https://avatars.githubusercontent.com/u/13093042?v=3","gravatar_id":"","url":"https://api.github.com/users/jasongin","html_url":"https://github.com/jasongin","followers_url":"https://api.github.com/users/jasongin/followers","following_url":"https://api.github.com/users/jasongin/following{/other_user}","gists_url":"https://api.github.com/users/jasongin/gists{/gist_id}","starred_url":"https://api.github.com/users/jasongin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasongin/subscriptions","organizations_url":"https://api.github.com/users/jasongin/orgs","repos_url":"https://api.github.com/users/jasongin/repos","events_url":"https://api.github.com/users/jasongin/events{/privacy}","received_events_url":"https://api.github.com/users/jasongin/received_events","type":"User","site_admin":false},"body":"Pass the Error object to reject(), not just the message.","created_at":"2016-06-15T22:36:29Z","updated_at":"2016-06-15T22:36:29Z","html_url":"https://github.com/openT2T/translators/pull/16#discussion_r67258736","pull_request_url":"https://api.github.com/repos/openT2T/translators/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/openT2T/translators/pulls/comments/67258736"},"html":{"href":"https://github.com/openT2T/translators/pull/16#discussion_r67258736"},"pull_request":{"href":"https://api.github.com/repos/openT2T/translators/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/openT2T/translators/pulls/16","id":73990741,"html_url":"https://github.com/openT2T/translators/pull/16","diff_url":"https://github.com/openT2T/translators/pull/16.diff","patch_url":"https://github.com/openT2T/translators/pull/16.patch","issue_url":"https://api.github.com/repos/openT2T/translators/issues/16","number":16,"state":"closed","locked":false,"title":"Added wink helper and thermostat","user":{"login":"rlingineni","id":5509813,"avatar_url":"https://avatars.githubusercontent.com/u/5509813?v=3","gravatar_id":"","url":"https://api.github.com/users/rlingineni","html_url":"https://github.com/rlingineni","followers_url":"https://api.github.com/users/rlingineni/followers","following_url":"https://api.github.com/users/rlingineni/following{/other_user}","gists_url":"https://api.github.com/users/rlingineni/gists{/gist_id}","starred_url":"https://api.github.com/users/rlingineni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlingineni/subscriptions","organizations_url":"https://api.github.com/users/rlingineni/orgs","repos_url":"https://api.github.com/users/rlingineni/repos","events_url":"https://api.github.com/users/rlingineni/events{/privacy}","received_events_url":"https://api.github.com/users/rlingineni/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-15T21:53:01Z","updated_at":"2016-06-15T22:36:29Z","closed_at":"2016-06-15T22:19:14Z","merged_at":"2016-06-15T22:19:14Z","merge_commit_sha":"335fe1672a81f4774eb443a62775fd33e4f9f8a5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openT2T/translators/pulls/16/commits","review_comments_url":"https://api.github.com/repos/openT2T/translators/pulls/16/comments","review_comment_url":"https://api.github.com/repos/openT2T/translators/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openT2T/translators/issues/16/comments","statuses_url":"https://api.github.com/repos/openT2T/translators/statuses/335fe1672a81f4774eb443a62775fd33e4f9f8a5","head":{"label":"rlingineni:wink","ref":"wink","sha":"335fe1672a81f4774eb443a62775fd33e4f9f8a5","user":{"login":"rlingineni","id":5509813,"avatar_url":"https://avatars.githubusercontent.com/u/5509813?v=3","gravatar_id":"","url":"https://api.github.com/users/rlingineni","html_url":"https://github.com/rlingineni","followers_url":"https://api.github.com/users/rlingineni/followers","following_url":"https://api.github.com/users/rlingineni/following{/other_user}","gists_url":"https://api.github.com/users/rlingineni/gists{/gist_id}","starred_url":"https://api.github.com/users/rlingineni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlingineni/subscriptions","organizations_url":"https://api.github.com/users/rlingineni/orgs","repos_url":"https://api.github.com/users/rlingineni/repos","events_url":"https://api.github.com/users/rlingineni/events{/privacy}","received_events_url":"https://api.github.com/users/rlingineni/received_events","type":"User","site_admin":false},"repo":{"id":60822843,"name":"translators","full_name":"rlingineni/translators","owner":{"login":"rlingineni","id":5509813,"avatar_url":"https://avatars.githubusercontent.com/u/5509813?v=3","gravatar_id":"","url":"https://api.github.com/users/rlingineni","html_url":"https://github.com/rlingineni","followers_url":"https://api.github.com/users/rlingineni/followers","following_url":"https://api.github.com/users/rlingineni/following{/other_user}","gists_url":"https://api.github.com/users/rlingineni/gists{/gist_id}","starred_url":"https://api.github.com/users/rlingineni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlingineni/subscriptions","organizations_url":"https://api.github.com/users/rlingineni/orgs","repos_url":"https://api.github.com/users/rlingineni/repos","events_url":"https://api.github.com/users/rlingineni/events{/privacy}","received_events_url":"https://api.github.com/users/rlingineni/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rlingineni/translators","description":"Repository for Open Translators to Things. ","fork":true,"url":"https://api.github.com/repos/rlingineni/translators","forks_url":"https://api.github.com/repos/rlingineni/translators/forks","keys_url":"https://api.github.com/repos/rlingineni/translators/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rlingineni/translators/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rlingineni/translators/teams","hooks_url":"https://api.github.com/repos/rlingineni/translators/hooks","issue_events_url":"https://api.github.com/repos/rlingineni/translators/issues/events{/number}","events_url":"https://api.github.com/repos/rlingineni/translators/events","assignees_url":"https://api.github.com/repos/rlingineni/translators/assignees{/user}","branches_url":"https://api.github.com/repos/rlingineni/translators/branches{/branch}","tags_url":"https://api.github.com/repos/rlingineni/translators/tags","blobs_url":"https://api.github.com/repos/rlingineni/translators/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rlingineni/translators/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rlingineni/translators/git/refs{/sha}","trees_url":"https://api.github.com/repos/rlingineni/translators/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rlingineni/translators/statuses/{sha}","languages_url":"https://api.github.com/repos/rlingineni/translators/languages","stargazers_url":"https://api.github.com/repos/rlingineni/translators/stargazers","contributors_url":"https://api.github.com/repos/rlingineni/translators/contributors","subscribers_url":"https://api.github.com/repos/rlingineni/translators/subscribers","subscription_url":"https://api.github.com/repos/rlingineni/translators/subscription","commits_url":"https://api.github.com/repos/rlingineni/translators/commits{/sha}","git_commits_url":"https://api.github.com/repos/rlingineni/translators/git/commits{/sha}","comments_url":"https://api.github.com/repos/rlingineni/translators/comments{/number}","issue_comment_url":"https://api.github.com/repos/rlingineni/translators/issues/comments{/number}","contents_url":"https://api.github.com/repos/rlingineni/translators/contents/{+path}","compare_url":"https://api.github.com/repos/rlingineni/translators/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rlingineni/translators/merges","archive_url":"https://api.github.com/repos/rlingineni/translators/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rlingineni/translators/downloads","issues_url":"https://api.github.com/repos/rlingineni/translators/issues{/number}","pulls_url":"https://api.github.com/repos/rlingineni/translators/pulls{/number}","milestones_url":"https://api.github.com/repos/rlingineni/translators/milestones{/number}","notifications_url":"https://api.github.com/repos/rlingineni/translators/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rlingineni/translators/labels{/name}","releases_url":"https://api.github.com/repos/rlingineni/translators/releases{/id}","deployments_url":"https://api.github.com/repos/rlingineni/translators/deployments","created_at":"2016-06-10T03:54:04Z","updated_at":"2016-06-10T03:54:05Z","pushed_at":"2016-06-15T22:07:51Z","git_url":"git://github.com/rlingineni/translators.git","ssh_url":"git@github.com:rlingineni/translators.git","clone_url":"https://github.com/rlingineni/translators.git","svn_url":"https://github.com/rlingineni/translators","homepage":"http://www.opentranslatorstothings.org","size":69,"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":"openT2T:master","ref":"master","sha":"f82865053109793ec6792db675c9b59f06e7a754","user":{"login":"openT2T","id":17659874,"avatar_url":"https://avatars.githubusercontent.com/u/17659874?v=3","gravatar_id":"","url":"https://api.github.com/users/openT2T","html_url":"https://github.com/openT2T","followers_url":"https://api.github.com/users/openT2T/followers","following_url":"https://api.github.com/users/openT2T/following{/other_user}","gists_url":"https://api.github.com/users/openT2T/gists{/gist_id}","starred_url":"https://api.github.com/users/openT2T/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openT2T/subscriptions","organizations_url":"https://api.github.com/users/openT2T/orgs","repos_url":"https://api.github.com/users/openT2T/repos","events_url":"https://api.github.com/users/openT2T/events{/privacy}","received_events_url":"https://api.github.com/users/openT2T/received_events","type":"Organization","site_admin":false},"repo":{"id":55200869,"name":"translators","full_name":"openT2T/translators","owner":{"login":"openT2T","id":17659874,"avatar_url":"https://avatars.githubusercontent.com/u/17659874?v=3","gravatar_id":"","url":"https://api.github.com/users/openT2T","html_url":"https://github.com/openT2T","followers_url":"https://api.github.com/users/openT2T/followers","following_url":"https://api.github.com/users/openT2T/following{/other_user}","gists_url":"https://api.github.com/users/openT2T/gists{/gist_id}","starred_url":"https://api.github.com/users/openT2T/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openT2T/subscriptions","organizations_url":"https://api.github.com/users/openT2T/orgs","repos_url":"https://api.github.com/users/openT2T/repos","events_url":"https://api.github.com/users/openT2T/events{/privacy}","received_events_url":"https://api.github.com/users/openT2T/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openT2T/translators","description":"Repository for Open Translators to Things. ","fork":false,"url":"https://api.github.com/repos/openT2T/translators","forks_url":"https://api.github.com/repos/openT2T/translators/forks","keys_url":"https://api.github.com/repos/openT2T/translators/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openT2T/translators/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openT2T/translators/teams","hooks_url":"https://api.github.com/repos/openT2T/translators/hooks","issue_events_url":"https://api.github.com/repos/openT2T/translators/issues/events{/number}","events_url":"https://api.github.com/repos/openT2T/translators/events","assignees_url":"https://api.github.com/repos/openT2T/translators/assignees{/user}","branches_url":"https://api.github.com/repos/openT2T/translators/branches{/branch}","tags_url":"https://api.github.com/repos/openT2T/translators/tags","blobs_url":"https://api.github.com/repos/openT2T/translators/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openT2T/translators/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openT2T/translators/git/refs{/sha}","trees_url":"https://api.github.com/repos/openT2T/translators/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openT2T/translators/statuses/{sha}","languages_url":"https://api.github.com/repos/openT2T/translators/languages","stargazers_url":"https://api.github.com/repos/openT2T/translators/stargazers","contributors_url":"https://api.github.com/repos/openT2T/translators/contributors","subscribers_url":"https://api.github.com/repos/openT2T/translators/subscribers","subscription_url":"https://api.github.com/repos/openT2T/translators/subscription","commits_url":"https://api.github.com/repos/openT2T/translators/commits{/sha}","git_commits_url":"https://api.github.com/repos/openT2T/translators/git/commits{/sha}","comments_url":"https://api.github.com/repos/openT2T/translators/comments{/number}","issue_comment_url":"https://api.github.com/repos/openT2T/translators/issues/comments{/number}","contents_url":"https://api.github.com/repos/openT2T/translators/contents/{+path}","compare_url":"https://api.github.com/repos/openT2T/translators/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openT2T/translators/merges","archive_url":"https://api.github.com/repos/openT2T/translators/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openT2T/translators/downloads","issues_url":"https://api.github.com/repos/openT2T/translators/issues{/number}","pulls_url":"https://api.github.com/repos/openT2T/translators/pulls{/number}","milestones_url":"https://api.github.com/repos/openT2T/translators/milestones{/number}","notifications_url":"https://api.github.com/repos/openT2T/translators/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openT2T/translators/labels{/name}","releases_url":"https://api.github.com/repos/openT2T/translators/releases{/id}","deployments_url":"https://api.github.com/repos/openT2T/translators/deployments","created_at":"2016-04-01T03:25:20Z","updated_at":"2016-06-10T18:14:17Z","pushed_at":"2016-06-15T22:34:33Z","git_url":"git://github.com/openT2T/translators.git","ssh_url":"git@github.com:openT2T/translators.git","clone_url":"https://github.com/openT2T/translators.git","svn_url":"https://github.com/openT2T/translators","homepage":"http://www.opentranslatorstothings.org","size":82,"stargazers_count":17,"watchers_count":17,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":9,"forks":14,"open_issues":9,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openT2T/translators/pulls/16"},"html":{"href":"https://github.com/openT2T/translators/pull/16"},"issue":{"href":"https://api.github.com/repos/openT2T/translators/issues/16"},"comments":{"href":"https://api.github.com/repos/openT2T/translators/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/openT2T/translators/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/openT2T/translators/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openT2T/translators/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/openT2T/translators/statuses/335fe1672a81f4774eb443a62775fd33e4f9f8a5"}}}}
{"actor":{"display_login":"jasongin"}}