{"action":"created","comment":{"url":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls/comments/69910542","id":69910542,"diff_hunk":"@@ -0,0 +1,86 @@\n+const util = require('util');\n+const http = require('http');\n+const gpDetailsParser = require('../utilities/gpDetailsParser');\n+const gpOpeningTimesParser = require('../utilities/gpOpeningTimesParser');\n+const daysOfTheWeek = require('../utilities/constants').daysOfTheWeek;\n+\n+function getDetails(req, res, next) {\n+  http.get(req.urlForGp, (response) => {\n+    let syndicationXml = '';\n+    response.on('data', (chunk) => {\n+      syndicationXml += chunk;\n+    });\n+\n+    response.on('end', () => {\n+      if (response.statusCode === 200) {\n+        /* Disabled since assigning to res is recommended best practice my Express */\n+        /* eslint-disable no-param-reassign */\n+        req.gpDetails = gpDetailsParser(syndicationXml);\n+        next();\n+      } else if (response.statusCode === 404) {\n+        const err = new Error('GP Not Found');\n+        err.status = 404;\n+        next(err);\n+      } else {\n+        next(`Error: ${response.statusCode}`);\n+      }\n+    });\n+  }).on('error', (e) => {\n+    console.log('Got an error: ', e);\n+    next(e);\n+  });\n+}\n+\n+function getOpeningTimes(req, res, next) {\n+  http.get(req.gpDetails.overviewLink, (response) => {","path":"app/middleware/gp.js","position":35,"original_position":35,"commit_id":"e4b4986ce6e50425115b395a5ec77b20e48acb7c","original_commit_id":"e4b4986ce6e50425115b395a5ec77b20e48acb7c","user":{"login":"st3v3nhunt","id":639706,"avatar_url":"https://avatars.githubusercontent.com/u/639706?v=3","gravatar_id":"","url":"https://api.github.com/users/st3v3nhunt","html_url":"https://github.com/st3v3nhunt","followers_url":"https://api.github.com/users/st3v3nhunt/followers","following_url":"https://api.github.com/users/st3v3nhunt/following{/other_user}","gists_url":"https://api.github.com/users/st3v3nhunt/gists{/gist_id}","starred_url":"https://api.github.com/users/st3v3nhunt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/st3v3nhunt/subscriptions","organizations_url":"https://api.github.com/users/st3v3nhunt/orgs","repos_url":"https://api.github.com/users/st3v3nhunt/repos","events_url":"https://api.github.com/users/st3v3nhunt/events{/privacy}","received_events_url":"https://api.github.com/users/st3v3nhunt/received_events","type":"User","site_admin":false},"body":"What happens if the link or `gpDetails` is null/empty?","created_at":"2016-07-07T13:57:22Z","updated_at":"2016-07-07T13:57:22Z","html_url":"https://github.com/nhsalpha/gp-to-services/pull/71#discussion_r69910542","pull_request_url":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls/71","_links":{"self":{"href":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls/comments/69910542"},"html":{"href":"https://github.com/nhsalpha/gp-to-services/pull/71#discussion_r69910542"},"pull_request":{"href":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls/71"}}},"pull_request":{"url":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls/71","id":76391840,"html_url":"https://github.com/nhsalpha/gp-to-services/pull/71","diff_url":"https://github.com/nhsalpha/gp-to-services/pull/71.diff","patch_url":"https://github.com/nhsalpha/gp-to-services/pull/71.patch","issue_url":"https://api.github.com/repos/nhsalpha/gp-to-services/issues/71","number":71,"state":"open","locked":false,"title":"Add opening times to GP display","user":{"login":"neilbmclaughlin","id":212582,"avatar_url":"https://avatars.githubusercontent.com/u/212582?v=3","gravatar_id":"","url":"https://api.github.com/users/neilbmclaughlin","html_url":"https://github.com/neilbmclaughlin","followers_url":"https://api.github.com/users/neilbmclaughlin/followers","following_url":"https://api.github.com/users/neilbmclaughlin/following{/other_user}","gists_url":"https://api.github.com/users/neilbmclaughlin/gists{/gist_id}","starred_url":"https://api.github.com/users/neilbmclaughlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neilbmclaughlin/subscriptions","organizations_url":"https://api.github.com/users/neilbmclaughlin/orgs","repos_url":"https://api.github.com/users/neilbmclaughlin/repos","events_url":"https://api.github.com/users/neilbmclaughlin/events{/privacy}","received_events_url":"https://api.github.com/users/neilbmclaughlin/received_events","type":"User","site_admin":false},"body":"Still much refactoring to do but created pull request for visibility.","created_at":"2016-07-06T07:56:27Z","updated_at":"2016-07-07T13:57:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07fbdf1b99d49ab68b1edca1921742353988f3d9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls/71/commits","review_comments_url":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls/71/comments","review_comment_url":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nhsalpha/gp-to-services/issues/71/comments","statuses_url":"https://api.github.com/repos/nhsalpha/gp-to-services/statuses/e4b4986ce6e50425115b395a5ec77b20e48acb7c","head":{"label":"nhsalpha:feature/use-xml-feed","ref":"feature/use-xml-feed","sha":"e4b4986ce6e50425115b395a5ec77b20e48acb7c","user":{"login":"nhsalpha","id":12557899,"avatar_url":"https://avatars.githubusercontent.com/u/12557899?v=3","gravatar_id":"","url":"https://api.github.com/users/nhsalpha","html_url":"https://github.com/nhsalpha","followers_url":"https://api.github.com/users/nhsalpha/followers","following_url":"https://api.github.com/users/nhsalpha/following{/other_user}","gists_url":"https://api.github.com/users/nhsalpha/gists{/gist_id}","starred_url":"https://api.github.com/users/nhsalpha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhsalpha/subscriptions","organizations_url":"https://api.github.com/users/nhsalpha/orgs","repos_url":"https://api.github.com/users/nhsalpha/repos","events_url":"https://api.github.com/users/nhsalpha/events{/privacy}","received_events_url":"https://api.github.com/users/nhsalpha/received_events","type":"Organization","site_admin":false},"repo":{"id":59567710,"name":"gp-to-services","full_name":"nhsalpha/gp-to-services","owner":{"login":"nhsalpha","id":12557899,"avatar_url":"https://avatars.githubusercontent.com/u/12557899?v=3","gravatar_id":"","url":"https://api.github.com/users/nhsalpha","html_url":"https://github.com/nhsalpha","followers_url":"https://api.github.com/users/nhsalpha/followers","following_url":"https://api.github.com/users/nhsalpha/following{/other_user}","gists_url":"https://api.github.com/users/nhsalpha/gists{/gist_id}","starred_url":"https://api.github.com/users/nhsalpha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhsalpha/subscriptions","organizations_url":"https://api.github.com/users/nhsalpha/orgs","repos_url":"https://api.github.com/users/nhsalpha/repos","events_url":"https://api.github.com/users/nhsalpha/events{/privacy}","received_events_url":"https://api.github.com/users/nhsalpha/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nhsalpha/gp-to-services","description":"Connecting the user journey from GP details to services","fork":false,"url":"https://api.github.com/repos/nhsalpha/gp-to-services","forks_url":"https://api.github.com/repos/nhsalpha/gp-to-services/forks","keys_url":"https://api.github.com/repos/nhsalpha/gp-to-services/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nhsalpha/gp-to-services/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nhsalpha/gp-to-services/teams","hooks_url":"https://api.github.com/repos/nhsalpha/gp-to-services/hooks","issue_events_url":"https://api.github.com/repos/nhsalpha/gp-to-services/issues/events{/number}","events_url":"https://api.github.com/repos/nhsalpha/gp-to-services/events","assignees_url":"https://api.github.com/repos/nhsalpha/gp-to-services/assignees{/user}","branches_url":"https://api.github.com/repos/nhsalpha/gp-to-services/branches{/branch}","tags_url":"https://api.github.com/repos/nhsalpha/gp-to-services/tags","blobs_url":"https://api.github.com/repos/nhsalpha/gp-to-services/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nhsalpha/gp-to-services/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nhsalpha/gp-to-services/git/refs{/sha}","trees_url":"https://api.github.com/repos/nhsalpha/gp-to-services/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nhsalpha/gp-to-services/statuses/{sha}","languages_url":"https://api.github.com/repos/nhsalpha/gp-to-services/languages","stargazers_url":"https://api.github.com/repos/nhsalpha/gp-to-services/stargazers","contributors_url":"https://api.github.com/repos/nhsalpha/gp-to-services/contributors","subscribers_url":"https://api.github.com/repos/nhsalpha/gp-to-services/subscribers","subscription_url":"https://api.github.com/repos/nhsalpha/gp-to-services/subscription","commits_url":"https://api.github.com/repos/nhsalpha/gp-to-services/commits{/sha}","git_commits_url":"https://api.github.com/repos/nhsalpha/gp-to-services/git/commits{/sha}","comments_url":"https://api.github.com/repos/nhsalpha/gp-to-services/comments{/number}","issue_comment_url":"https://api.github.com/repos/nhsalpha/gp-to-services/issues/comments{/number}","contents_url":"https://api.github.com/repos/nhsalpha/gp-to-services/contents/{+path}","compare_url":"https://api.github.com/repos/nhsalpha/gp-to-services/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nhsalpha/gp-to-services/merges","archive_url":"https://api.github.com/repos/nhsalpha/gp-to-services/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nhsalpha/gp-to-services/downloads","issues_url":"https://api.github.com/repos/nhsalpha/gp-to-services/issues{/number}","pulls_url":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls{/number}","milestones_url":"https://api.github.com/repos/nhsalpha/gp-to-services/milestones{/number}","notifications_url":"https://api.github.com/repos/nhsalpha/gp-to-services/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nhsalpha/gp-to-services/labels{/name}","releases_url":"https://api.github.com/repos/nhsalpha/gp-to-services/releases{/id}","deployments_url":"https://api.github.com/repos/nhsalpha/gp-to-services/deployments","created_at":"2016-05-24T11:36:16Z","updated_at":"2016-05-24T14:05:55Z","pushed_at":"2016-07-07T07:52:27Z","git_url":"git://github.com/nhsalpha/gp-to-services.git","ssh_url":"git@github.com:nhsalpha/gp-to-services.git","clone_url":"https://github.com/nhsalpha/gp-to-services.git","svn_url":"https://github.com/nhsalpha/gp-to-services","homepage":null,"size":277,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":8,"forks":0,"open_issues":8,"watchers":0,"default_branch":"master"}},"base":{"label":"nhsalpha:master","ref":"master","sha":"7a092fb9c7e820915a3cdd955561ae447c16b8dc","user":{"login":"nhsalpha","id":12557899,"avatar_url":"https://avatars.githubusercontent.com/u/12557899?v=3","gravatar_id":"","url":"https://api.github.com/users/nhsalpha","html_url":"https://github.com/nhsalpha","followers_url":"https://api.github.com/users/nhsalpha/followers","following_url":"https://api.github.com/users/nhsalpha/following{/other_user}","gists_url":"https://api.github.com/users/nhsalpha/gists{/gist_id}","starred_url":"https://api.github.com/users/nhsalpha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhsalpha/subscriptions","organizations_url":"https://api.github.com/users/nhsalpha/orgs","repos_url":"https://api.github.com/users/nhsalpha/repos","events_url":"https://api.github.com/users/nhsalpha/events{/privacy}","received_events_url":"https://api.github.com/users/nhsalpha/received_events","type":"Organization","site_admin":false},"repo":{"id":59567710,"name":"gp-to-services","full_name":"nhsalpha/gp-to-services","owner":{"login":"nhsalpha","id":12557899,"avatar_url":"https://avatars.githubusercontent.com/u/12557899?v=3","gravatar_id":"","url":"https://api.github.com/users/nhsalpha","html_url":"https://github.com/nhsalpha","followers_url":"https://api.github.com/users/nhsalpha/followers","following_url":"https://api.github.com/users/nhsalpha/following{/other_user}","gists_url":"https://api.github.com/users/nhsalpha/gists{/gist_id}","starred_url":"https://api.github.com/users/nhsalpha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhsalpha/subscriptions","organizations_url":"https://api.github.com/users/nhsalpha/orgs","repos_url":"https://api.github.com/users/nhsalpha/repos","events_url":"https://api.github.com/users/nhsalpha/events{/privacy}","received_events_url":"https://api.github.com/users/nhsalpha/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nhsalpha/gp-to-services","description":"Connecting the user journey from GP details to services","fork":false,"url":"https://api.github.com/repos/nhsalpha/gp-to-services","forks_url":"https://api.github.com/repos/nhsalpha/gp-to-services/forks","keys_url":"https://api.github.com/repos/nhsalpha/gp-to-services/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nhsalpha/gp-to-services/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nhsalpha/gp-to-services/teams","hooks_url":"https://api.github.com/repos/nhsalpha/gp-to-services/hooks","issue_events_url":"https://api.github.com/repos/nhsalpha/gp-to-services/issues/events{/number}","events_url":"https://api.github.com/repos/nhsalpha/gp-to-services/events","assignees_url":"https://api.github.com/repos/nhsalpha/gp-to-services/assignees{/user}","branches_url":"https://api.github.com/repos/nhsalpha/gp-to-services/branches{/branch}","tags_url":"https://api.github.com/repos/nhsalpha/gp-to-services/tags","blobs_url":"https://api.github.com/repos/nhsalpha/gp-to-services/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nhsalpha/gp-to-services/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nhsalpha/gp-to-services/git/refs{/sha}","trees_url":"https://api.github.com/repos/nhsalpha/gp-to-services/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nhsalpha/gp-to-services/statuses/{sha}","languages_url":"https://api.github.com/repos/nhsalpha/gp-to-services/languages","stargazers_url":"https://api.github.com/repos/nhsalpha/gp-to-services/stargazers","contributors_url":"https://api.github.com/repos/nhsalpha/gp-to-services/contributors","subscribers_url":"https://api.github.com/repos/nhsalpha/gp-to-services/subscribers","subscription_url":"https://api.github.com/repos/nhsalpha/gp-to-services/subscription","commits_url":"https://api.github.com/repos/nhsalpha/gp-to-services/commits{/sha}","git_commits_url":"https://api.github.com/repos/nhsalpha/gp-to-services/git/commits{/sha}","comments_url":"https://api.github.com/repos/nhsalpha/gp-to-services/comments{/number}","issue_comment_url":"https://api.github.com/repos/nhsalpha/gp-to-services/issues/comments{/number}","contents_url":"https://api.github.com/repos/nhsalpha/gp-to-services/contents/{+path}","compare_url":"https://api.github.com/repos/nhsalpha/gp-to-services/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nhsalpha/gp-to-services/merges","archive_url":"https://api.github.com/repos/nhsalpha/gp-to-services/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nhsalpha/gp-to-services/downloads","issues_url":"https://api.github.com/repos/nhsalpha/gp-to-services/issues{/number}","pulls_url":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls{/number}","milestones_url":"https://api.github.com/repos/nhsalpha/gp-to-services/milestones{/number}","notifications_url":"https://api.github.com/repos/nhsalpha/gp-to-services/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nhsalpha/gp-to-services/labels{/name}","releases_url":"https://api.github.com/repos/nhsalpha/gp-to-services/releases{/id}","deployments_url":"https://api.github.com/repos/nhsalpha/gp-to-services/deployments","created_at":"2016-05-24T11:36:16Z","updated_at":"2016-05-24T14:05:55Z","pushed_at":"2016-07-07T07:52:27Z","git_url":"git://github.com/nhsalpha/gp-to-services.git","ssh_url":"git@github.com:nhsalpha/gp-to-services.git","clone_url":"https://github.com/nhsalpha/gp-to-services.git","svn_url":"https://github.com/nhsalpha/gp-to-services","homepage":null,"size":277,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":8,"forks":0,"open_issues":8,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls/71"},"html":{"href":"https://github.com/nhsalpha/gp-to-services/pull/71"},"issue":{"href":"https://api.github.com/repos/nhsalpha/gp-to-services/issues/71"},"comments":{"href":"https://api.github.com/repos/nhsalpha/gp-to-services/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nhsalpha/gp-to-services/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/nhsalpha/gp-to-services/statuses/e4b4986ce6e50425115b395a5ec77b20e48acb7c"}}}}
{"actor":{"display_login":"st3v3nhunt"}}