{"action":"created","comment":{"url":"https://api.github.com/repos/yetu/controlcenter/pulls/comments/26653683","id":26653683,"diff_hunk":"@@ -0,0 +1,47 @@\n+var Rx = require('rx'),\n+  _ = require('lodash'),\n+  qwest = require('qwest');\n+\n+var thingsUrl = 'http://householdmockapi000.yetudev.com:8080/things';\n+var MAX_DEVICES = 100; // allow to add up to 100 devices\n+\n+function extractProperties (sirenData) {\n+  sirenData = sirenData || {};\n+  return sirenData.properties;\n+}\n+\n+function extractThingsUrls (sirenThingsUrls) {\n+  sirenThingsUrls = sirenThingsUrls || [];\n+  var urls = sirenThingsUrls.entities\n+    .filter(function filterNullValues (item) {\n+      return item !== null && item.href !== null;\n+    })\n+    .map(function extractHref (item) {\n+      return item.href;\n+    });\n+\n+  // create observable from array of urls\n+  return Rx.Observable.from(urls);\n+}\n+\n+function deviceInfo (deviceUrl) {\n+  return Rx.Observable.fromPromise(\n+    qwest.get(deviceUrl, null, {responseType: 'json'})\n+  ).map(extractProperties);\n+}\n+\n+// For now it's only for things from Household API\n+var $deviceList = Rx.Observable.fromPromise(qwest.get(thingsUrl, null, {responseType: 'json'}));\n+\n+// TODO add device control actions here (change room, remove adjust)\n+module.exports = {\n+  fetchDeviceInfo: function fetchDeviceInfo (deviceUrl) {","path":"public/app/common/servcies/devices/devices-service/devices-service.js","position":38,"original_position":38,"commit_id":"bd62c3e6ff634c9e1a928b19f7ac15e947ecca17","original_commit_id":"bd62c3e6ff634c9e1a928b19f7ac15e947ecca17","user":{"login":"mr-mig","id":1062491,"avatar_url":"https://avatars.githubusercontent.com/u/1062491?v=3","gravatar_id":"","url":"https://api.github.com/users/mr-mig","html_url":"https://github.com/mr-mig","followers_url":"https://api.github.com/users/mr-mig/followers","following_url":"https://api.github.com/users/mr-mig/following{/other_user}","gists_url":"https://api.github.com/users/mr-mig/gists{/gist_id}","starred_url":"https://api.github.com/users/mr-mig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mr-mig/subscriptions","organizations_url":"https://api.github.com/users/mr-mig/orgs","repos_url":"https://api.github.com/users/mr-mig/repos","events_url":"https://api.github.com/users/mr-mig/events{/privacy}","received_events_url":"https://api.github.com/users/mr-mig/received_events","type":"User","site_admin":false},"body":"Even better: `fetchDeviceInfo: deviceInfo`","created_at":"2015-03-18T11:03:52Z","updated_at":"2015-03-18T11:03:52Z","html_url":"https://github.com/yetu/controlcenter/pull/49#discussion_r26653683","pull_request_url":"https://api.github.com/repos/yetu/controlcenter/pulls/49","_links":{"self":{"href":"https://api.github.com/repos/yetu/controlcenter/pulls/comments/26653683"},"html":{"href":"https://github.com/yetu/controlcenter/pull/49#discussion_r26653683"},"pull_request":{"href":"https://api.github.com/repos/yetu/controlcenter/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/yetu/controlcenter/pulls/49","id":31417359,"html_url":"https://github.com/yetu/controlcenter/pull/49","diff_url":"https://github.com/yetu/controlcenter/pull/49.diff","patch_url":"https://github.com/yetu/controlcenter/pull/49.patch","issue_url":"https://api.github.com/repos/yetu/controlcenter/issues/49","number":49,"state":"open","locked":false,"title":"Added list devices","user":{"login":"dev-tim","id":5173831,"avatar_url":"https://avatars.githubusercontent.com/u/5173831?v=3","gravatar_id":"","url":"https://api.github.com/users/dev-tim","html_url":"https://github.com/dev-tim","followers_url":"https://api.github.com/users/dev-tim/followers","following_url":"https://api.github.com/users/dev-tim/following{/other_user}","gists_url":"https://api.github.com/users/dev-tim/gists{/gist_id}","starred_url":"https://api.github.com/users/dev-tim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dev-tim/subscriptions","organizations_url":"https://api.github.com/users/dev-tim/orgs","repos_url":"https://api.github.com/users/dev-tim/repos","events_url":"https://api.github.com/users/dev-tim/events{/privacy}","received_events_url":"https://api.github.com/users/dev-tim/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-18T10:47:38Z","updated_at":"2015-03-18T11:03:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yetu/controlcenter/pulls/49/commits","review_comments_url":"https://api.github.com/repos/yetu/controlcenter/pulls/49/comments","review_comment_url":"https://api.github.com/repos/yetu/controlcenter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yetu/controlcenter/issues/49/comments","statuses_url":"https://api.github.com/repos/yetu/controlcenter/statuses/bd62c3e6ff634c9e1a928b19f7ac15e947ecca17","head":{"label":"yetu:feature/list-devices","ref":"feature/list-devices","sha":"bd62c3e6ff634c9e1a928b19f7ac15e947ecca17","user":{"login":"yetu","id":2630913,"avatar_url":"https://avatars.githubusercontent.com/u/2630913?v=3","gravatar_id":"","url":"https://api.github.com/users/yetu","html_url":"https://github.com/yetu","followers_url":"https://api.github.com/users/yetu/followers","following_url":"https://api.github.com/users/yetu/following{/other_user}","gists_url":"https://api.github.com/users/yetu/gists{/gist_id}","starred_url":"https://api.github.com/users/yetu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yetu/subscriptions","organizations_url":"https://api.github.com/users/yetu/orgs","repos_url":"https://api.github.com/users/yetu/repos","events_url":"https://api.github.com/users/yetu/events{/privacy}","received_events_url":"https://api.github.com/users/yetu/received_events","type":"Organization","site_admin":false},"repo":{"id":31211976,"name":"controlcenter","full_name":"yetu/controlcenter","owner":{"login":"yetu","id":2630913,"avatar_url":"https://avatars.githubusercontent.com/u/2630913?v=3","gravatar_id":"","url":"https://api.github.com/users/yetu","html_url":"https://github.com/yetu","followers_url":"https://api.github.com/users/yetu/followers","following_url":"https://api.github.com/users/yetu/following{/other_user}","gists_url":"https://api.github.com/users/yetu/gists{/gist_id}","starred_url":"https://api.github.com/users/yetu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yetu/subscriptions","organizations_url":"https://api.github.com/users/yetu/orgs","repos_url":"https://api.github.com/users/yetu/repos","events_url":"https://api.github.com/users/yetu/events{/privacy}","received_events_url":"https://api.github.com/users/yetu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yetu/controlcenter","description":"SPA app for controlling devices and user preferences ","fork":false,"url":"https://api.github.com/repos/yetu/controlcenter","forks_url":"https://api.github.com/repos/yetu/controlcenter/forks","keys_url":"https://api.github.com/repos/yetu/controlcenter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yetu/controlcenter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yetu/controlcenter/teams","hooks_url":"https://api.github.com/repos/yetu/controlcenter/hooks","issue_events_url":"https://api.github.com/repos/yetu/controlcenter/issues/events{/number}","events_url":"https://api.github.com/repos/yetu/controlcenter/events","assignees_url":"https://api.github.com/repos/yetu/controlcenter/assignees{/user}","branches_url":"https://api.github.com/repos/yetu/controlcenter/branches{/branch}","tags_url":"https://api.github.com/repos/yetu/controlcenter/tags","blobs_url":"https://api.github.com/repos/yetu/controlcenter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yetu/controlcenter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yetu/controlcenter/git/refs{/sha}","trees_url":"https://api.github.com/repos/yetu/controlcenter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yetu/controlcenter/statuses/{sha}","languages_url":"https://api.github.com/repos/yetu/controlcenter/languages","stargazers_url":"https://api.github.com/repos/yetu/controlcenter/stargazers","contributors_url":"https://api.github.com/repos/yetu/controlcenter/contributors","subscribers_url":"https://api.github.com/repos/yetu/controlcenter/subscribers","subscription_url":"https://api.github.com/repos/yetu/controlcenter/subscription","commits_url":"https://api.github.com/repos/yetu/controlcenter/commits{/sha}","git_commits_url":"https://api.github.com/repos/yetu/controlcenter/git/commits{/sha}","comments_url":"https://api.github.com/repos/yetu/controlcenter/comments{/number}","issue_comment_url":"https://api.github.com/repos/yetu/controlcenter/issues/comments{/number}","contents_url":"https://api.github.com/repos/yetu/controlcenter/contents/{+path}","compare_url":"https://api.github.com/repos/yetu/controlcenter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yetu/controlcenter/merges","archive_url":"https://api.github.com/repos/yetu/controlcenter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yetu/controlcenter/downloads","issues_url":"https://api.github.com/repos/yetu/controlcenter/issues{/number}","pulls_url":"https://api.github.com/repos/yetu/controlcenter/pulls{/number}","milestones_url":"https://api.github.com/repos/yetu/controlcenter/milestones{/number}","notifications_url":"https://api.github.com/repos/yetu/controlcenter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yetu/controlcenter/labels{/name}","releases_url":"https://api.github.com/repos/yetu/controlcenter/releases{/id}","created_at":"2015-02-23T14:41:12Z","updated_at":"2015-03-18T10:16:01Z","pushed_at":"2015-03-18T10:16:01Z","git_url":"git://github.com/yetu/controlcenter.git","ssh_url":"git@github.com:yetu/controlcenter.git","clone_url":"https://github.com/yetu/controlcenter.git","svn_url":"https://github.com/yetu/controlcenter","homepage":"","size":4491,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":6,"forks":2,"open_issues":6,"watchers":4,"default_branch":"master"}},"base":{"label":"yetu:master","ref":"master","sha":"6a4afe67b0cf82f6c47e641448cb58512b010f47","user":{"login":"yetu","id":2630913,"avatar_url":"https://avatars.githubusercontent.com/u/2630913?v=3","gravatar_id":"","url":"https://api.github.com/users/yetu","html_url":"https://github.com/yetu","followers_url":"https://api.github.com/users/yetu/followers","following_url":"https://api.github.com/users/yetu/following{/other_user}","gists_url":"https://api.github.com/users/yetu/gists{/gist_id}","starred_url":"https://api.github.com/users/yetu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yetu/subscriptions","organizations_url":"https://api.github.com/users/yetu/orgs","repos_url":"https://api.github.com/users/yetu/repos","events_url":"https://api.github.com/users/yetu/events{/privacy}","received_events_url":"https://api.github.com/users/yetu/received_events","type":"Organization","site_admin":false},"repo":{"id":31211976,"name":"controlcenter","full_name":"yetu/controlcenter","owner":{"login":"yetu","id":2630913,"avatar_url":"https://avatars.githubusercontent.com/u/2630913?v=3","gravatar_id":"","url":"https://api.github.com/users/yetu","html_url":"https://github.com/yetu","followers_url":"https://api.github.com/users/yetu/followers","following_url":"https://api.github.com/users/yetu/following{/other_user}","gists_url":"https://api.github.com/users/yetu/gists{/gist_id}","starred_url":"https://api.github.com/users/yetu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yetu/subscriptions","organizations_url":"https://api.github.com/users/yetu/orgs","repos_url":"https://api.github.com/users/yetu/repos","events_url":"https://api.github.com/users/yetu/events{/privacy}","received_events_url":"https://api.github.com/users/yetu/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yetu/controlcenter","description":"SPA app for controlling devices and user preferences ","fork":false,"url":"https://api.github.com/repos/yetu/controlcenter","forks_url":"https://api.github.com/repos/yetu/controlcenter/forks","keys_url":"https://api.github.com/repos/yetu/controlcenter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yetu/controlcenter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yetu/controlcenter/teams","hooks_url":"https://api.github.com/repos/yetu/controlcenter/hooks","issue_events_url":"https://api.github.com/repos/yetu/controlcenter/issues/events{/number}","events_url":"https://api.github.com/repos/yetu/controlcenter/events","assignees_url":"https://api.github.com/repos/yetu/controlcenter/assignees{/user}","branches_url":"https://api.github.com/repos/yetu/controlcenter/branches{/branch}","tags_url":"https://api.github.com/repos/yetu/controlcenter/tags","blobs_url":"https://api.github.com/repos/yetu/controlcenter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yetu/controlcenter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yetu/controlcenter/git/refs{/sha}","trees_url":"https://api.github.com/repos/yetu/controlcenter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yetu/controlcenter/statuses/{sha}","languages_url":"https://api.github.com/repos/yetu/controlcenter/languages","stargazers_url":"https://api.github.com/repos/yetu/controlcenter/stargazers","contributors_url":"https://api.github.com/repos/yetu/controlcenter/contributors","subscribers_url":"https://api.github.com/repos/yetu/controlcenter/subscribers","subscription_url":"https://api.github.com/repos/yetu/controlcenter/subscription","commits_url":"https://api.github.com/repos/yetu/controlcenter/commits{/sha}","git_commits_url":"https://api.github.com/repos/yetu/controlcenter/git/commits{/sha}","comments_url":"https://api.github.com/repos/yetu/controlcenter/comments{/number}","issue_comment_url":"https://api.github.com/repos/yetu/controlcenter/issues/comments{/number}","contents_url":"https://api.github.com/repos/yetu/controlcenter/contents/{+path}","compare_url":"https://api.github.com/repos/yetu/controlcenter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yetu/controlcenter/merges","archive_url":"https://api.github.com/repos/yetu/controlcenter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yetu/controlcenter/downloads","issues_url":"https://api.github.com/repos/yetu/controlcenter/issues{/number}","pulls_url":"https://api.github.com/repos/yetu/controlcenter/pulls{/number}","milestones_url":"https://api.github.com/repos/yetu/controlcenter/milestones{/number}","notifications_url":"https://api.github.com/repos/yetu/controlcenter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yetu/controlcenter/labels{/name}","releases_url":"https://api.github.com/repos/yetu/controlcenter/releases{/id}","created_at":"2015-02-23T14:41:12Z","updated_at":"2015-03-18T10:16:01Z","pushed_at":"2015-03-18T10:16:01Z","git_url":"git://github.com/yetu/controlcenter.git","ssh_url":"git@github.com:yetu/controlcenter.git","clone_url":"https://github.com/yetu/controlcenter.git","svn_url":"https://github.com/yetu/controlcenter","homepage":"","size":4491,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":6,"forks":2,"open_issues":6,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yetu/controlcenter/pulls/49"},"html":{"href":"https://github.com/yetu/controlcenter/pull/49"},"issue":{"href":"https://api.github.com/repos/yetu/controlcenter/issues/49"},"comments":{"href":"https://api.github.com/repos/yetu/controlcenter/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/yetu/controlcenter/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/yetu/controlcenter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yetu/controlcenter/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/yetu/controlcenter/statuses/bd62c3e6ff634c9e1a928b19f7ac15e947ecca17"}}}}