{"action":"created","comment":{"url":"https://api.github.com/repos/relayr/browser-sdk/pulls/comments/68710790","id":68710790,"diff_hunk":"@@ -1,64 +1,74 @@\n import Ajax from '../tools/ajax.js';\n+import Device from './Device';\n \n export default class User {\n-  constructor(config) {\n-    this.config = config;\n-    this.ajax = new Ajax(config.ajax);\n-  }\n+    constructor(config) {\n+        this.config = config;\n+        this.ajax = new Ajax(config.ajax);\n+    }\n \n-  getUserInfo() {\n-    return new Promise((resolve, reject) => {\n-      if (this.userInfo) {\n-        resolve(this.userInfo);\n-      } else {\n-        this.ajax.get('/oauth2/user-info').then((response) => {\n-          this.userInfo = response;\n-          resolve(response);\n-        }).catch((error) => {\n-          reject(error);\n+    getUserInfo() {\n+        return new Promise((resolve, reject) => {\n+            if (this.userInfo) {\n+                resolve(this.userInfo);\n+            } else {\n+                this.ajax.get('/oauth2/user-info').then((response) => {\n+                    this.userInfo = response;\n+                    resolve(response);\n+                }).catch((error) => {\n+                    reject(error);\n+                });\n+\n+            }\n         });\n+    }\n+\n+    getMyDevices(opts = {}) {\n+        return new Promise((resolve, reject) => {\n+            this.getUserInfo().then(() => {\n+\n+                this.ajax.get(`/users/${this.userInfo.id}/devices`).then((response) => {\n \n-      }\n-    });\n-  }\n+                    if (opts.asClasses) {","path":"src/entities/User.js","position":49,"original_position":49,"commit_id":"70a54c98e6d1f4057e0c72081e5e42d44da2898e","original_commit_id":"70a54c98e6d1f4057e0c72081e5e42d44da2898e","user":{"login":"jontore","id":163290,"avatar_url":"https://avatars.githubusercontent.com/u/163290?v=3","gravatar_id":"","url":"https://api.github.com/users/jontore","html_url":"https://github.com/jontore","followers_url":"https://api.github.com/users/jontore/followers","following_url":"https://api.github.com/users/jontore/following{/other_user}","gists_url":"https://api.github.com/users/jontore/gists{/gist_id}","starred_url":"https://api.github.com/users/jontore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jontore/subscriptions","organizations_url":"https://api.github.com/users/jontore/orgs","repos_url":"https://api.github.com/users/jontore/repos","events_url":"https://api.github.com/users/jontore/events{/privacy}","received_events_url":"https://api.github.com/users/jontore/received_events","type":"User","site_admin":false},"body":"I think a good refactoring in the future is to have a super entity with helpers for these things that all the entities can inherit from. ","created_at":"2016-06-28T07:44:14Z","updated_at":"2016-06-28T07:44:14Z","html_url":"https://github.com/relayr/browser-sdk/pull/42#discussion_r68710790","pull_request_url":"https://api.github.com/repos/relayr/browser-sdk/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/relayr/browser-sdk/pulls/comments/68710790"},"html":{"href":"https://github.com/relayr/browser-sdk/pull/42#discussion_r68710790"},"pull_request":{"href":"https://api.github.com/repos/relayr/browser-sdk/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/relayr/browser-sdk/pulls/42","id":75320390,"html_url":"https://github.com/relayr/browser-sdk/pull/42","diff_url":"https://github.com/relayr/browser-sdk/pull/42.diff","patch_url":"https://github.com/relayr/browser-sdk/pull/42.patch","issue_url":"https://api.github.com/repos/relayr/browser-sdk/issues/42","number":42,"state":"open","locked":false,"title":"return device classes as an option in user.getMyDevices, this enables…","user":{"login":"SmbatYeranyan","id":6469521,"avatar_url":"https://avatars.githubusercontent.com/u/6469521?v=3","gravatar_id":"","url":"https://api.github.com/users/SmbatYeranyan","html_url":"https://github.com/SmbatYeranyan","followers_url":"https://api.github.com/users/SmbatYeranyan/followers","following_url":"https://api.github.com/users/SmbatYeranyan/following{/other_user}","gists_url":"https://api.github.com/users/SmbatYeranyan/gists{/gist_id}","starred_url":"https://api.github.com/users/SmbatYeranyan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SmbatYeranyan/subscriptions","organizations_url":"https://api.github.com/users/SmbatYeranyan/orgs","repos_url":"https://api.github.com/users/SmbatYeranyan/repos","events_url":"https://api.github.com/users/SmbatYeranyan/events{/privacy}","received_events_url":"https://api.github.com/users/SmbatYeranyan/received_events","type":"User","site_admin":false},"body":"… easy access to Model class and device operations","created_at":"2016-06-27T14:26:25Z","updated_at":"2016-06-28T07:44:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"09bd2bf781adfb8f0d15757234263ab8275fbba1","assignee":{"login":"jontore","id":163290,"avatar_url":"https://avatars.githubusercontent.com/u/163290?v=3","gravatar_id":"","url":"https://api.github.com/users/jontore","html_url":"https://github.com/jontore","followers_url":"https://api.github.com/users/jontore/followers","following_url":"https://api.github.com/users/jontore/following{/other_user}","gists_url":"https://api.github.com/users/jontore/gists{/gist_id}","starred_url":"https://api.github.com/users/jontore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jontore/subscriptions","organizations_url":"https://api.github.com/users/jontore/orgs","repos_url":"https://api.github.com/users/jontore/repos","events_url":"https://api.github.com/users/jontore/events{/privacy}","received_events_url":"https://api.github.com/users/jontore/received_events","type":"User","site_admin":false},"assignees":[{"login":"jontore","id":163290,"avatar_url":"https://avatars.githubusercontent.com/u/163290?v=3","gravatar_id":"","url":"https://api.github.com/users/jontore","html_url":"https://github.com/jontore","followers_url":"https://api.github.com/users/jontore/followers","following_url":"https://api.github.com/users/jontore/following{/other_user}","gists_url":"https://api.github.com/users/jontore/gists{/gist_id}","starred_url":"https://api.github.com/users/jontore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jontore/subscriptions","organizations_url":"https://api.github.com/users/jontore/orgs","repos_url":"https://api.github.com/users/jontore/repos","events_url":"https://api.github.com/users/jontore/events{/privacy}","received_events_url":"https://api.github.com/users/jontore/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/relayr/browser-sdk/pulls/42/commits","review_comments_url":"https://api.github.com/repos/relayr/browser-sdk/pulls/42/comments","review_comment_url":"https://api.github.com/repos/relayr/browser-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/relayr/browser-sdk/issues/42/comments","statuses_url":"https://api.github.com/repos/relayr/browser-sdk/statuses/70a54c98e6d1f4057e0c72081e5e42d44da2898e","head":{"label":"relayr:2.0.0-dev-return-device-classes","ref":"2.0.0-dev-return-device-classes","sha":"70a54c98e6d1f4057e0c72081e5e42d44da2898e","user":{"login":"relayr","id":5864098,"avatar_url":"https://avatars.githubusercontent.com/u/5864098?v=3","gravatar_id":"","url":"https://api.github.com/users/relayr","html_url":"https://github.com/relayr","followers_url":"https://api.github.com/users/relayr/followers","following_url":"https://api.github.com/users/relayr/following{/other_user}","gists_url":"https://api.github.com/users/relayr/gists{/gist_id}","starred_url":"https://api.github.com/users/relayr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/relayr/subscriptions","organizations_url":"https://api.github.com/users/relayr/orgs","repos_url":"https://api.github.com/users/relayr/repos","events_url":"https://api.github.com/users/relayr/events{/privacy}","received_events_url":"https://api.github.com/users/relayr/received_events","type":"Organization","site_admin":false},"repo":{"id":24459386,"name":"browser-sdk","full_name":"relayr/browser-sdk","owner":{"login":"relayr","id":5864098,"avatar_url":"https://avatars.githubusercontent.com/u/5864098?v=3","gravatar_id":"","url":"https://api.github.com/users/relayr","html_url":"https://github.com/relayr","followers_url":"https://api.github.com/users/relayr/followers","following_url":"https://api.github.com/users/relayr/following{/other_user}","gists_url":"https://api.github.com/users/relayr/gists{/gist_id}","starred_url":"https://api.github.com/users/relayr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/relayr/subscriptions","organizations_url":"https://api.github.com/users/relayr/orgs","repos_url":"https://api.github.com/users/relayr/repos","events_url":"https://api.github.com/users/relayr/events{/privacy}","received_events_url":"https://api.github.com/users/relayr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/relayr/browser-sdk","description":"This easy to use JavaScript implementation will allow you to quickly create relayr browser side web applications, start receiving data from your sensors and display the data received in your browser. ","fork":false,"url":"https://api.github.com/repos/relayr/browser-sdk","forks_url":"https://api.github.com/repos/relayr/browser-sdk/forks","keys_url":"https://api.github.com/repos/relayr/browser-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/relayr/browser-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/relayr/browser-sdk/teams","hooks_url":"https://api.github.com/repos/relayr/browser-sdk/hooks","issue_events_url":"https://api.github.com/repos/relayr/browser-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/relayr/browser-sdk/events","assignees_url":"https://api.github.com/repos/relayr/browser-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/relayr/browser-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/relayr/browser-sdk/tags","blobs_url":"https://api.github.com/repos/relayr/browser-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/relayr/browser-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/relayr/browser-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/relayr/browser-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/relayr/browser-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/relayr/browser-sdk/languages","stargazers_url":"https://api.github.com/repos/relayr/browser-sdk/stargazers","contributors_url":"https://api.github.com/repos/relayr/browser-sdk/contributors","subscribers_url":"https://api.github.com/repos/relayr/browser-sdk/subscribers","subscription_url":"https://api.github.com/repos/relayr/browser-sdk/subscription","commits_url":"https://api.github.com/repos/relayr/browser-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/relayr/browser-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/relayr/browser-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/relayr/browser-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/relayr/browser-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/relayr/browser-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/relayr/browser-sdk/merges","archive_url":"https://api.github.com/repos/relayr/browser-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/relayr/browser-sdk/downloads","issues_url":"https://api.github.com/repos/relayr/browser-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/relayr/browser-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/relayr/browser-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/relayr/browser-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/relayr/browser-sdk/labels{/name}","releases_url":"https://api.github.com/repos/relayr/browser-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/relayr/browser-sdk/deployments","created_at":"2014-09-25T13:37:21Z","updated_at":"2016-01-14T10:33:45Z","pushed_at":"2016-06-27T15:13:53Z","git_url":"git://github.com/relayr/browser-sdk.git","ssh_url":"git@github.com:relayr/browser-sdk.git","clone_url":"https://github.com/relayr/browser-sdk.git","svn_url":"https://github.com/relayr/browser-sdk","homepage":"","size":1346,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":5,"forks":5,"open_issues":5,"watchers":7,"default_branch":"master"}},"base":{"label":"relayr:2.0.0-dev","ref":"2.0.0-dev","sha":"f18b0c938a373f18b8cb8cc163c01b1974d08191","user":{"login":"relayr","id":5864098,"avatar_url":"https://avatars.githubusercontent.com/u/5864098?v=3","gravatar_id":"","url":"https://api.github.com/users/relayr","html_url":"https://github.com/relayr","followers_url":"https://api.github.com/users/relayr/followers","following_url":"https://api.github.com/users/relayr/following{/other_user}","gists_url":"https://api.github.com/users/relayr/gists{/gist_id}","starred_url":"https://api.github.com/users/relayr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/relayr/subscriptions","organizations_url":"https://api.github.com/users/relayr/orgs","repos_url":"https://api.github.com/users/relayr/repos","events_url":"https://api.github.com/users/relayr/events{/privacy}","received_events_url":"https://api.github.com/users/relayr/received_events","type":"Organization","site_admin":false},"repo":{"id":24459386,"name":"browser-sdk","full_name":"relayr/browser-sdk","owner":{"login":"relayr","id":5864098,"avatar_url":"https://avatars.githubusercontent.com/u/5864098?v=3","gravatar_id":"","url":"https://api.github.com/users/relayr","html_url":"https://github.com/relayr","followers_url":"https://api.github.com/users/relayr/followers","following_url":"https://api.github.com/users/relayr/following{/other_user}","gists_url":"https://api.github.com/users/relayr/gists{/gist_id}","starred_url":"https://api.github.com/users/relayr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/relayr/subscriptions","organizations_url":"https://api.github.com/users/relayr/orgs","repos_url":"https://api.github.com/users/relayr/repos","events_url":"https://api.github.com/users/relayr/events{/privacy}","received_events_url":"https://api.github.com/users/relayr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/relayr/browser-sdk","description":"This easy to use JavaScript implementation will allow you to quickly create relayr browser side web applications, start receiving data from your sensors and display the data received in your browser. ","fork":false,"url":"https://api.github.com/repos/relayr/browser-sdk","forks_url":"https://api.github.com/repos/relayr/browser-sdk/forks","keys_url":"https://api.github.com/repos/relayr/browser-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/relayr/browser-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/relayr/browser-sdk/teams","hooks_url":"https://api.github.com/repos/relayr/browser-sdk/hooks","issue_events_url":"https://api.github.com/repos/relayr/browser-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/relayr/browser-sdk/events","assignees_url":"https://api.github.com/repos/relayr/browser-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/relayr/browser-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/relayr/browser-sdk/tags","blobs_url":"https://api.github.com/repos/relayr/browser-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/relayr/browser-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/relayr/browser-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/relayr/browser-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/relayr/browser-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/relayr/browser-sdk/languages","stargazers_url":"https://api.github.com/repos/relayr/browser-sdk/stargazers","contributors_url":"https://api.github.com/repos/relayr/browser-sdk/contributors","subscribers_url":"https://api.github.com/repos/relayr/browser-sdk/subscribers","subscription_url":"https://api.github.com/repos/relayr/browser-sdk/subscription","commits_url":"https://api.github.com/repos/relayr/browser-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/relayr/browser-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/relayr/browser-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/relayr/browser-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/relayr/browser-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/relayr/browser-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/relayr/browser-sdk/merges","archive_url":"https://api.github.com/repos/relayr/browser-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/relayr/browser-sdk/downloads","issues_url":"https://api.github.com/repos/relayr/browser-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/relayr/browser-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/relayr/browser-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/relayr/browser-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/relayr/browser-sdk/labels{/name}","releases_url":"https://api.github.com/repos/relayr/browser-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/relayr/browser-sdk/deployments","created_at":"2014-09-25T13:37:21Z","updated_at":"2016-01-14T10:33:45Z","pushed_at":"2016-06-27T15:13:53Z","git_url":"git://github.com/relayr/browser-sdk.git","ssh_url":"git@github.com:relayr/browser-sdk.git","clone_url":"https://github.com/relayr/browser-sdk.git","svn_url":"https://github.com/relayr/browser-sdk","homepage":"","size":1346,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":5,"forks":5,"open_issues":5,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/relayr/browser-sdk/pulls/42"},"html":{"href":"https://github.com/relayr/browser-sdk/pull/42"},"issue":{"href":"https://api.github.com/repos/relayr/browser-sdk/issues/42"},"comments":{"href":"https://api.github.com/repos/relayr/browser-sdk/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/relayr/browser-sdk/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/relayr/browser-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/relayr/browser-sdk/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/relayr/browser-sdk/statuses/70a54c98e6d1f4057e0c72081e5e42d44da2898e"}}}}
{"actor":{"display_login":"jontore"}}