{"action":"created","comment":{"url":"https://api.github.com/repos/sanger/aker-work-app/pulls/comments/191437969","pull_request_review_id":124001244,"id":191437969,"diff_hunk":"@@ -0,0 +1,41 @@\n+require \"faraday\"\n+\n+# Client to access the Data release strategies, currently accessed from Sequencescape\n+module DataReleaseStrategyClient\n+\n+  # Returns the data release strategy by uuid.\n+  def self.find_strategy_by_uuid(uuid)\n+    if uuid\n+      DataReleaseStrategy.find_by(id: uuid)\n+    end\n+  end\n+\n+  # Gets the list of strategies available for the user. It also updates the current database with\n+  # the response, as this keeps the local copy for the name of data releases up to date\n+  def self.find_strategies_by_user(user)\n+    conn = get_connection\n+\n+    username = user.gsub(/@.*/, '')\n+    studies = JSON.parse(conn.get('/api/v2/studies?filter[state]=active&filter[user]='+username).body)['data']\n+\n+    studies.map do |study|\n+      strategy = DataReleaseStrategy.find_or_create_by(id: study['attributes']['uuid'])\n+      strategy.update_with_study_info(study)\n+      strategy\n+    end.uniq\n+  end\n+\n+  # Connection to access the data release server\n+  def self.get_connection\n+    conn = Faraday.new(:url => Rails.application.config.ss_data_release_url) do |faraday|","path":"lib/data_release_strategy_client.rb","position":30,"original_position":30,"commit_id":"0b01b8cc25edba638ab084abb094f0c8bbb22d16","original_commit_id":"0b01b8cc25edba638ab084abb094f0c8bbb22d16","user":{"login":"NikolausC","id":18176485,"avatar_url":"https://avatars0.githubusercontent.com/u/18176485?v=4","gravatar_id":"","url":"https://api.github.com/users/NikolausC","html_url":"https://github.com/NikolausC","followers_url":"https://api.github.com/users/NikolausC/followers","following_url":"https://api.github.com/users/NikolausC/following{/other_user}","gists_url":"https://api.github.com/users/NikolausC/gists{/gist_id}","starred_url":"https://api.github.com/users/NikolausC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NikolausC/subscriptions","organizations_url":"https://api.github.com/users/NikolausC/orgs","repos_url":"https://api.github.com/users/NikolausC/repos","events_url":"https://api.github.com/users/NikolausC/events{/privacy}","received_events_url":"https://api.github.com/users/NikolausC/received_events","type":"User","site_admin":false},"body":"Please could you change this to config.data_release_url (so it's consistent with the Projects app)","created_at":"2018-05-29T14:08:22Z","updated_at":"2018-05-29T14:46:54Z","html_url":"https://github.com/sanger/aker-work-app/pull/273#discussion_r191437969","pull_request_url":"https://api.github.com/repos/sanger/aker-work-app/pulls/273","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/sanger/aker-work-app/pulls/comments/191437969"},"html":{"href":"https://github.com/sanger/aker-work-app/pull/273#discussion_r191437969"},"pull_request":{"href":"https://api.github.com/repos/sanger/aker-work-app/pulls/273"}}},"pull_request":{"url":"https://api.github.com/repos/sanger/aker-work-app/pulls/273","id":191152490,"html_url":"https://github.com/sanger/aker-work-app/pull/273","diff_url":"https://github.com/sanger/aker-work-app/pull/273.diff","patch_url":"https://github.com/sanger/aker-work-app/pull/273.patch","issue_url":"https://api.github.com/repos/sanger/aker-work-app/issues/273","number":273,"state":"open","locked":false,"title":"Add data release strategy to Work Plan","user":{"login":"harrietc52","id":11446617,"avatar_url":"https://avatars1.githubusercontent.com/u/11446617?v=4","gravatar_id":"","url":"https://api.github.com/users/harrietc52","html_url":"https://github.com/harrietc52","followers_url":"https://api.github.com/users/harrietc52/followers","following_url":"https://api.github.com/users/harrietc52/following{/other_user}","gists_url":"https://api.github.com/users/harrietc52/gists{/gist_id}","starred_url":"https://api.github.com/users/harrietc52/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harrietc52/subscriptions","organizations_url":"https://api.github.com/users/harrietc52/orgs","repos_url":"https://api.github.com/users/harrietc52/repos","events_url":"https://api.github.com/users/harrietc52/events{/privacy}","received_events_url":"https://api.github.com/users/harrietc52/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-05-29T13:47:46Z","updated_at":"2018-05-29T14:46:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a82957eec5ee9bf7468fe16646a1d6c60a955a01","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sanger/aker-work-app/pulls/273/commits","review_comments_url":"https://api.github.com/repos/sanger/aker-work-app/pulls/273/comments","review_comment_url":"https://api.github.com/repos/sanger/aker-work-app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sanger/aker-work-app/issues/273/comments","statuses_url":"https://api.github.com/repos/sanger/aker-work-app/statuses/0b01b8cc25edba638ab084abb094f0c8bbb22d16","head":{"label":"sanger:add_data_release_strategy","ref":"add_data_release_strategy","sha":"0b01b8cc25edba638ab084abb094f0c8bbb22d16","user":{"login":"sanger","id":63878,"avatar_url":"https://avatars1.githubusercontent.com/u/63878?v=4","gravatar_id":"","url":"https://api.github.com/users/sanger","html_url":"https://github.com/sanger","followers_url":"https://api.github.com/users/sanger/followers","following_url":"https://api.github.com/users/sanger/following{/other_user}","gists_url":"https://api.github.com/users/sanger/gists{/gist_id}","starred_url":"https://api.github.com/users/sanger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanger/subscriptions","organizations_url":"https://api.github.com/users/sanger/orgs","repos_url":"https://api.github.com/users/sanger/repos","events_url":"https://api.github.com/users/sanger/events{/privacy}","received_events_url":"https://api.github.com/users/sanger/received_events","type":"Organization","site_admin":false},"repo":{"id":71131909,"name":"aker-work-app","full_name":"sanger/aker-work-app","owner":{"login":"sanger","id":63878,"avatar_url":"https://avatars1.githubusercontent.com/u/63878?v=4","gravatar_id":"","url":"https://api.github.com/users/sanger","html_url":"https://github.com/sanger","followers_url":"https://api.github.com/users/sanger/followers","following_url":"https://api.github.com/users/sanger/following{/other_user}","gists_url":"https://api.github.com/users/sanger/gists{/gist_id}","starred_url":"https://api.github.com/users/sanger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanger/subscriptions","organizations_url":"https://api.github.com/users/sanger/orgs","repos_url":"https://api.github.com/users/sanger/repos","events_url":"https://api.github.com/users/sanger/events{/privacy}","received_events_url":"https://api.github.com/users/sanger/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sanger/aker-work-app","description":null,"fork":false,"url":"https://api.github.com/repos/sanger/aker-work-app","forks_url":"https://api.github.com/repos/sanger/aker-work-app/forks","keys_url":"https://api.github.com/repos/sanger/aker-work-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sanger/aker-work-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sanger/aker-work-app/teams","hooks_url":"https://api.github.com/repos/sanger/aker-work-app/hooks","issue_events_url":"https://api.github.com/repos/sanger/aker-work-app/issues/events{/number}","events_url":"https://api.github.com/repos/sanger/aker-work-app/events","assignees_url":"https://api.github.com/repos/sanger/aker-work-app/assignees{/user}","branches_url":"https://api.github.com/repos/sanger/aker-work-app/branches{/branch}","tags_url":"https://api.github.com/repos/sanger/aker-work-app/tags","blobs_url":"https://api.github.com/repos/sanger/aker-work-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sanger/aker-work-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sanger/aker-work-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/sanger/aker-work-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sanger/aker-work-app/statuses/{sha}","languages_url":"https://api.github.com/repos/sanger/aker-work-app/languages","stargazers_url":"https://api.github.com/repos/sanger/aker-work-app/stargazers","contributors_url":"https://api.github.com/repos/sanger/aker-work-app/contributors","subscribers_url":"https://api.github.com/repos/sanger/aker-work-app/subscribers","subscription_url":"https://api.github.com/repos/sanger/aker-work-app/subscription","commits_url":"https://api.github.com/repos/sanger/aker-work-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/sanger/aker-work-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/sanger/aker-work-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/sanger/aker-work-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/sanger/aker-work-app/contents/{+path}","compare_url":"https://api.github.com/repos/sanger/aker-work-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sanger/aker-work-app/merges","archive_url":"https://api.github.com/repos/sanger/aker-work-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sanger/aker-work-app/downloads","issues_url":"https://api.github.com/repos/sanger/aker-work-app/issues{/number}","pulls_url":"https://api.github.com/repos/sanger/aker-work-app/pulls{/number}","milestones_url":"https://api.github.com/repos/sanger/aker-work-app/milestones{/number}","notifications_url":"https://api.github.com/repos/sanger/aker-work-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sanger/aker-work-app/labels{/name}","releases_url":"https://api.github.com/repos/sanger/aker-work-app/releases{/id}","deployments_url":"https://api.github.com/repos/sanger/aker-work-app/deployments","created_at":"2016-10-17T11:39:12Z","updated_at":"2018-05-23T08:52:10Z","pushed_at":"2018-05-29T13:47:46Z","git_url":"git://github.com/sanger/aker-work-app.git","ssh_url":"git@github.com:sanger/aker-work-app.git","clone_url":"https://github.com/sanger/aker-work-app.git","svn_url":"https://github.com/sanger/aker-work-app","homepage":null,"size":5344,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":5,"open_issues":3,"watchers":1,"default_branch":"devel"}},"base":{"label":"sanger:devel","ref":"devel","sha":"1902ff2c548cb076225b50b51fe3f4696a35d47c","user":{"login":"sanger","id":63878,"avatar_url":"https://avatars1.githubusercontent.com/u/63878?v=4","gravatar_id":"","url":"https://api.github.com/users/sanger","html_url":"https://github.com/sanger","followers_url":"https://api.github.com/users/sanger/followers","following_url":"https://api.github.com/users/sanger/following{/other_user}","gists_url":"https://api.github.com/users/sanger/gists{/gist_id}","starred_url":"https://api.github.com/users/sanger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanger/subscriptions","organizations_url":"https://api.github.com/users/sanger/orgs","repos_url":"https://api.github.com/users/sanger/repos","events_url":"https://api.github.com/users/sanger/events{/privacy}","received_events_url":"https://api.github.com/users/sanger/received_events","type":"Organization","site_admin":false},"repo":{"id":71131909,"name":"aker-work-app","full_name":"sanger/aker-work-app","owner":{"login":"sanger","id":63878,"avatar_url":"https://avatars1.githubusercontent.com/u/63878?v=4","gravatar_id":"","url":"https://api.github.com/users/sanger","html_url":"https://github.com/sanger","followers_url":"https://api.github.com/users/sanger/followers","following_url":"https://api.github.com/users/sanger/following{/other_user}","gists_url":"https://api.github.com/users/sanger/gists{/gist_id}","starred_url":"https://api.github.com/users/sanger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanger/subscriptions","organizations_url":"https://api.github.com/users/sanger/orgs","repos_url":"https://api.github.com/users/sanger/repos","events_url":"https://api.github.com/users/sanger/events{/privacy}","received_events_url":"https://api.github.com/users/sanger/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sanger/aker-work-app","description":null,"fork":false,"url":"https://api.github.com/repos/sanger/aker-work-app","forks_url":"https://api.github.com/repos/sanger/aker-work-app/forks","keys_url":"https://api.github.com/repos/sanger/aker-work-app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sanger/aker-work-app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sanger/aker-work-app/teams","hooks_url":"https://api.github.com/repos/sanger/aker-work-app/hooks","issue_events_url":"https://api.github.com/repos/sanger/aker-work-app/issues/events{/number}","events_url":"https://api.github.com/repos/sanger/aker-work-app/events","assignees_url":"https://api.github.com/repos/sanger/aker-work-app/assignees{/user}","branches_url":"https://api.github.com/repos/sanger/aker-work-app/branches{/branch}","tags_url":"https://api.github.com/repos/sanger/aker-work-app/tags","blobs_url":"https://api.github.com/repos/sanger/aker-work-app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sanger/aker-work-app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sanger/aker-work-app/git/refs{/sha}","trees_url":"https://api.github.com/repos/sanger/aker-work-app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sanger/aker-work-app/statuses/{sha}","languages_url":"https://api.github.com/repos/sanger/aker-work-app/languages","stargazers_url":"https://api.github.com/repos/sanger/aker-work-app/stargazers","contributors_url":"https://api.github.com/repos/sanger/aker-work-app/contributors","subscribers_url":"https://api.github.com/repos/sanger/aker-work-app/subscribers","subscription_url":"https://api.github.com/repos/sanger/aker-work-app/subscription","commits_url":"https://api.github.com/repos/sanger/aker-work-app/commits{/sha}","git_commits_url":"https://api.github.com/repos/sanger/aker-work-app/git/commits{/sha}","comments_url":"https://api.github.com/repos/sanger/aker-work-app/comments{/number}","issue_comment_url":"https://api.github.com/repos/sanger/aker-work-app/issues/comments{/number}","contents_url":"https://api.github.com/repos/sanger/aker-work-app/contents/{+path}","compare_url":"https://api.github.com/repos/sanger/aker-work-app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sanger/aker-work-app/merges","archive_url":"https://api.github.com/repos/sanger/aker-work-app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sanger/aker-work-app/downloads","issues_url":"https://api.github.com/repos/sanger/aker-work-app/issues{/number}","pulls_url":"https://api.github.com/repos/sanger/aker-work-app/pulls{/number}","milestones_url":"https://api.github.com/repos/sanger/aker-work-app/milestones{/number}","notifications_url":"https://api.github.com/repos/sanger/aker-work-app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sanger/aker-work-app/labels{/name}","releases_url":"https://api.github.com/repos/sanger/aker-work-app/releases{/id}","deployments_url":"https://api.github.com/repos/sanger/aker-work-app/deployments","created_at":"2016-10-17T11:39:12Z","updated_at":"2018-05-23T08:52:10Z","pushed_at":"2018-05-29T13:47:46Z","git_url":"git://github.com/sanger/aker-work-app.git","ssh_url":"git@github.com:sanger/aker-work-app.git","clone_url":"https://github.com/sanger/aker-work-app.git","svn_url":"https://github.com/sanger/aker-work-app","homepage":null,"size":5344,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":5,"open_issues":3,"watchers":1,"default_branch":"devel"}},"_links":{"self":{"href":"https://api.github.com/repos/sanger/aker-work-app/pulls/273"},"html":{"href":"https://github.com/sanger/aker-work-app/pull/273"},"issue":{"href":"https://api.github.com/repos/sanger/aker-work-app/issues/273"},"comments":{"href":"https://api.github.com/repos/sanger/aker-work-app/issues/273/comments"},"review_comments":{"href":"https://api.github.com/repos/sanger/aker-work-app/pulls/273/comments"},"review_comment":{"href":"https://api.github.com/repos/sanger/aker-work-app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sanger/aker-work-app/pulls/273/commits"},"statuses":{"href":"https://api.github.com/repos/sanger/aker-work-app/statuses/0b01b8cc25edba638ab084abb094f0c8bbb22d16"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"NikolausC"}}