{"action":"created","comment":{"url":"https://api.github.com/repos/VTUL/data-repo/pulls/comments/217780815","pull_request_review_id":155582040,"id":217780815,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNzc4MDgxNQ==","diff_hunk":"@@ -170,4 +171,25 @@ def dataset_download\n     end\n     send_file zip_file\n   end\n+\n+  def build_citation collection\n+    return nil unless (!collection.identifier.blank? && collection.identifier.first.include?(\"doi:\"))\n+    datacite_api_base = \"https://api.datacite.org/application/vnd.schemaorg.ld+json/\"\n+    datacite_id = collection.identifier.first.gsub(\"doi:\", \"\")\n+    datacite_api_url = File.join(datacite_api_base, datacite_id)    \n+    begin\n+      response = HTTParty.get(datacite_api_url)   \n+      datacite_record = JSON.parse(response.body)\n+    rescue\n+      logger.error \"Error fetching datacite record for collection\"\n+    end\n+    return nil unless  !datacite_record.nil?\n+    creator = \"#{datacite_record['author']['familyName']}, #{datacite_record['author']['givenName'][0]}.\"","path":"app/controllers/collections_controller.rb","position":25,"original_position":25,"commit_id":"b1a89b952d3db2ace8e50d39162d92e80b56a6e5","original_commit_id":"b1a89b952d3db2ace8e50d39162d92e80b56a6e5","user":{"login":"tingtingjh","id":8228221,"node_id":"MDQ6VXNlcjgyMjgyMjE=","avatar_url":"https://avatars2.githubusercontent.com/u/8228221?v=4","gravatar_id":"","url":"https://api.github.com/users/tingtingjh","html_url":"https://github.com/tingtingjh","followers_url":"https://api.github.com/users/tingtingjh/followers","following_url":"https://api.github.com/users/tingtingjh/following{/other_user}","gists_url":"https://api.github.com/users/tingtingjh/gists{/gist_id}","starred_url":"https://api.github.com/users/tingtingjh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tingtingjh/subscriptions","organizations_url":"https://api.github.com/users/tingtingjh/orgs","repos_url":"https://api.github.com/users/tingtingjh/repos","events_url":"https://api.github.com/users/tingtingjh/events{/privacy}","received_events_url":"https://api.github.com/users/tingtingjh/received_events","type":"User","site_admin":false},"body":"You might want to check the validity of the datacite doi, for example, if I used an invalid doi such as \"doi:10.7294/w4bg2kws\", the application will throw an error with the datacite_record not being nil.","created_at":"2018-09-14T17:07:38Z","updated_at":"2018-09-14T17:08:05Z","html_url":"https://github.com/VTUL/data-repo/pull/228#discussion_r217780815","pull_request_url":"https://api.github.com/repos/VTUL/data-repo/pulls/228","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/VTUL/data-repo/pulls/comments/217780815"},"html":{"href":"https://github.com/VTUL/data-repo/pull/228#discussion_r217780815"},"pull_request":{"href":"https://api.github.com/repos/VTUL/data-repo/pulls/228"}}},"pull_request":{"url":"https://api.github.com/repos/VTUL/data-repo/pulls/228","id":215005154,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE1MDA1MTU0","html_url":"https://github.com/VTUL/data-repo/pull/228","diff_url":"https://github.com/VTUL/data-repo/pull/228.diff","patch_url":"https://github.com/VTUL/data-repo/pull/228.patch","issue_url":"https://api.github.com/repos/VTUL/data-repo/issues/228","number":228,"state":"open","locked":false,"title":"build citation from datacite api info","user":{"login":"whunter","id":1202435,"node_id":"MDQ6VXNlcjEyMDI0MzU=","avatar_url":"https://avatars2.githubusercontent.com/u/1202435?v=4","gravatar_id":"","url":"https://api.github.com/users/whunter","html_url":"https://github.com/whunter","followers_url":"https://api.github.com/users/whunter/followers","following_url":"https://api.github.com/users/whunter/following{/other_user}","gists_url":"https://api.github.com/users/whunter/gists{/gist_id}","starred_url":"https://api.github.com/users/whunter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whunter/subscriptions","organizations_url":"https://api.github.com/users/whunter/orgs","repos_url":"https://api.github.com/users/whunter/repos","events_url":"https://api.github.com/users/whunter/events{/privacy}","received_events_url":"https://api.github.com/users/whunter/received_events","type":"User","site_admin":false},"body":"**Render datacite citation on dataset show page for datasets that have already been published**\r\n* * *\r\n\r\n**JIRA Ticket**: (https://webapps.es.vt.edu/jira/browse/LIBTD-1353) (:star:)\r\n\r\n# What does this Pull Request do? (:star:)\r\nPulls metadata from datacite for datasets that have been \"published.\" Constructs citation that matches the format on datacite and renders it on the dataset show page.\r\n\r\n# What's the changes? (:star:)\r\nPulls metadata from datacite for datasets that have been \"published.\" Constructs citation that matches the format on datacite and renders it on the dataset show page.\r\n\r\n# How should this be tested?\r\n* Create a dataset\r\n* Add a valid doi from datacite (https://doi.datacite.org/clients/viva.vt) to the identifier field\r\n* Check that the citation renders on the show page below the name and description (if there is one).\r\n\r\n# Additional Notes:\r\n* branch: `collection_citations`\r\n\r\n\r\n# Interested parties\r\n@tingtingjh \r\n\r\n(:star:) Required fields\r\n","created_at":"2018-09-12T15:31:20Z","updated_at":"2018-09-14T17:08:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"27ad2d975223d9014c2b4121d45bc32ebec4a798","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/VTUL/data-repo/pulls/228/commits","review_comments_url":"https://api.github.com/repos/VTUL/data-repo/pulls/228/comments","review_comment_url":"https://api.github.com/repos/VTUL/data-repo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/VTUL/data-repo/issues/228/comments","statuses_url":"https://api.github.com/repos/VTUL/data-repo/statuses/b1a89b952d3db2ace8e50d39162d92e80b56a6e5","head":{"label":"VTUL:collection_citations","ref":"collection_citations","sha":"b1a89b952d3db2ace8e50d39162d92e80b56a6e5","user":{"login":"VTUL","id":5315685,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzMTU2ODU=","avatar_url":"https://avatars2.githubusercontent.com/u/5315685?v=4","gravatar_id":"","url":"https://api.github.com/users/VTUL","html_url":"https://github.com/VTUL","followers_url":"https://api.github.com/users/VTUL/followers","following_url":"https://api.github.com/users/VTUL/following{/other_user}","gists_url":"https://api.github.com/users/VTUL/gists{/gist_id}","starred_url":"https://api.github.com/users/VTUL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VTUL/subscriptions","organizations_url":"https://api.github.com/users/VTUL/orgs","repos_url":"https://api.github.com/users/VTUL/repos","events_url":"https://api.github.com/users/VTUL/events{/privacy}","received_events_url":"https://api.github.com/users/VTUL/received_events","type":"Organization","site_admin":false},"repo":{"id":35899331,"node_id":"MDEwOlJlcG9zaXRvcnkzNTg5OTMzMQ==","name":"data-repo","full_name":"VTUL/data-repo","owner":{"login":"VTUL","id":5315685,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzMTU2ODU=","avatar_url":"https://avatars2.githubusercontent.com/u/5315685?v=4","gravatar_id":"","url":"https://api.github.com/users/VTUL","html_url":"https://github.com/VTUL","followers_url":"https://api.github.com/users/VTUL/followers","following_url":"https://api.github.com/users/VTUL/following{/other_user}","gists_url":"https://api.github.com/users/VTUL/gists{/gist_id}","starred_url":"https://api.github.com/users/VTUL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VTUL/subscriptions","organizations_url":"https://api.github.com/users/VTUL/orgs","repos_url":"https://api.github.com/users/VTUL/repos","events_url":"https://api.github.com/users/VTUL/events{/privacy}","received_events_url":"https://api.github.com/users/VTUL/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VTUL/data-repo","description":null,"fork":false,"url":"https://api.github.com/repos/VTUL/data-repo","forks_url":"https://api.github.com/repos/VTUL/data-repo/forks","keys_url":"https://api.github.com/repos/VTUL/data-repo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VTUL/data-repo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VTUL/data-repo/teams","hooks_url":"https://api.github.com/repos/VTUL/data-repo/hooks","issue_events_url":"https://api.github.com/repos/VTUL/data-repo/issues/events{/number}","events_url":"https://api.github.com/repos/VTUL/data-repo/events","assignees_url":"https://api.github.com/repos/VTUL/data-repo/assignees{/user}","branches_url":"https://api.github.com/repos/VTUL/data-repo/branches{/branch}","tags_url":"https://api.github.com/repos/VTUL/data-repo/tags","blobs_url":"https://api.github.com/repos/VTUL/data-repo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VTUL/data-repo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VTUL/data-repo/git/refs{/sha}","trees_url":"https://api.github.com/repos/VTUL/data-repo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VTUL/data-repo/statuses/{sha}","languages_url":"https://api.github.com/repos/VTUL/data-repo/languages","stargazers_url":"https://api.github.com/repos/VTUL/data-repo/stargazers","contributors_url":"https://api.github.com/repos/VTUL/data-repo/contributors","subscribers_url":"https://api.github.com/repos/VTUL/data-repo/subscribers","subscription_url":"https://api.github.com/repos/VTUL/data-repo/subscription","commits_url":"https://api.github.com/repos/VTUL/data-repo/commits{/sha}","git_commits_url":"https://api.github.com/repos/VTUL/data-repo/git/commits{/sha}","comments_url":"https://api.github.com/repos/VTUL/data-repo/comments{/number}","issue_comment_url":"https://api.github.com/repos/VTUL/data-repo/issues/comments{/number}","contents_url":"https://api.github.com/repos/VTUL/data-repo/contents/{+path}","compare_url":"https://api.github.com/repos/VTUL/data-repo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VTUL/data-repo/merges","archive_url":"https://api.github.com/repos/VTUL/data-repo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VTUL/data-repo/downloads","issues_url":"https://api.github.com/repos/VTUL/data-repo/issues{/number}","pulls_url":"https://api.github.com/repos/VTUL/data-repo/pulls{/number}","milestones_url":"https://api.github.com/repos/VTUL/data-repo/milestones{/number}","notifications_url":"https://api.github.com/repos/VTUL/data-repo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VTUL/data-repo/labels{/name}","releases_url":"https://api.github.com/repos/VTUL/data-repo/releases{/id}","deployments_url":"https://api.github.com/repos/VTUL/data-repo/deployments","created_at":"2015-05-19T18:02:05Z","updated_at":"2018-08-27T15:21:54Z","pushed_at":"2018-09-12T17:45:27Z","git_url":"git://github.com/VTUL/data-repo.git","ssh_url":"git@github.com:VTUL/data-repo.git","clone_url":"https://github.com/VTUL/data-repo.git","svn_url":"https://github.com/VTUL/data-repo","homepage":"http://data.lib.vt.edu/","size":30649,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":2,"open_issues":5,"watchers":5,"default_branch":"master"}},"base":{"label":"VTUL:master","ref":"master","sha":"e5eed2c914da104f752b19981db4dbccb84b1286","user":{"login":"VTUL","id":5315685,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzMTU2ODU=","avatar_url":"https://avatars2.githubusercontent.com/u/5315685?v=4","gravatar_id":"","url":"https://api.github.com/users/VTUL","html_url":"https://github.com/VTUL","followers_url":"https://api.github.com/users/VTUL/followers","following_url":"https://api.github.com/users/VTUL/following{/other_user}","gists_url":"https://api.github.com/users/VTUL/gists{/gist_id}","starred_url":"https://api.github.com/users/VTUL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VTUL/subscriptions","organizations_url":"https://api.github.com/users/VTUL/orgs","repos_url":"https://api.github.com/users/VTUL/repos","events_url":"https://api.github.com/users/VTUL/events{/privacy}","received_events_url":"https://api.github.com/users/VTUL/received_events","type":"Organization","site_admin":false},"repo":{"id":35899331,"node_id":"MDEwOlJlcG9zaXRvcnkzNTg5OTMzMQ==","name":"data-repo","full_name":"VTUL/data-repo","owner":{"login":"VTUL","id":5315685,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzMTU2ODU=","avatar_url":"https://avatars2.githubusercontent.com/u/5315685?v=4","gravatar_id":"","url":"https://api.github.com/users/VTUL","html_url":"https://github.com/VTUL","followers_url":"https://api.github.com/users/VTUL/followers","following_url":"https://api.github.com/users/VTUL/following{/other_user}","gists_url":"https://api.github.com/users/VTUL/gists{/gist_id}","starred_url":"https://api.github.com/users/VTUL/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VTUL/subscriptions","organizations_url":"https://api.github.com/users/VTUL/orgs","repos_url":"https://api.github.com/users/VTUL/repos","events_url":"https://api.github.com/users/VTUL/events{/privacy}","received_events_url":"https://api.github.com/users/VTUL/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/VTUL/data-repo","description":null,"fork":false,"url":"https://api.github.com/repos/VTUL/data-repo","forks_url":"https://api.github.com/repos/VTUL/data-repo/forks","keys_url":"https://api.github.com/repos/VTUL/data-repo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VTUL/data-repo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VTUL/data-repo/teams","hooks_url":"https://api.github.com/repos/VTUL/data-repo/hooks","issue_events_url":"https://api.github.com/repos/VTUL/data-repo/issues/events{/number}","events_url":"https://api.github.com/repos/VTUL/data-repo/events","assignees_url":"https://api.github.com/repos/VTUL/data-repo/assignees{/user}","branches_url":"https://api.github.com/repos/VTUL/data-repo/branches{/branch}","tags_url":"https://api.github.com/repos/VTUL/data-repo/tags","blobs_url":"https://api.github.com/repos/VTUL/data-repo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VTUL/data-repo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VTUL/data-repo/git/refs{/sha}","trees_url":"https://api.github.com/repos/VTUL/data-repo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VTUL/data-repo/statuses/{sha}","languages_url":"https://api.github.com/repos/VTUL/data-repo/languages","stargazers_url":"https://api.github.com/repos/VTUL/data-repo/stargazers","contributors_url":"https://api.github.com/repos/VTUL/data-repo/contributors","subscribers_url":"https://api.github.com/repos/VTUL/data-repo/subscribers","subscription_url":"https://api.github.com/repos/VTUL/data-repo/subscription","commits_url":"https://api.github.com/repos/VTUL/data-repo/commits{/sha}","git_commits_url":"https://api.github.com/repos/VTUL/data-repo/git/commits{/sha}","comments_url":"https://api.github.com/repos/VTUL/data-repo/comments{/number}","issue_comment_url":"https://api.github.com/repos/VTUL/data-repo/issues/comments{/number}","contents_url":"https://api.github.com/repos/VTUL/data-repo/contents/{+path}","compare_url":"https://api.github.com/repos/VTUL/data-repo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VTUL/data-repo/merges","archive_url":"https://api.github.com/repos/VTUL/data-repo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VTUL/data-repo/downloads","issues_url":"https://api.github.com/repos/VTUL/data-repo/issues{/number}","pulls_url":"https://api.github.com/repos/VTUL/data-repo/pulls{/number}","milestones_url":"https://api.github.com/repos/VTUL/data-repo/milestones{/number}","notifications_url":"https://api.github.com/repos/VTUL/data-repo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VTUL/data-repo/labels{/name}","releases_url":"https://api.github.com/repos/VTUL/data-repo/releases{/id}","deployments_url":"https://api.github.com/repos/VTUL/data-repo/deployments","created_at":"2015-05-19T18:02:05Z","updated_at":"2018-08-27T15:21:54Z","pushed_at":"2018-09-12T17:45:27Z","git_url":"git://github.com/VTUL/data-repo.git","ssh_url":"git@github.com:VTUL/data-repo.git","clone_url":"https://github.com/VTUL/data-repo.git","svn_url":"https://github.com/VTUL/data-repo","homepage":"http://data.lib.vt.edu/","size":30649,"stargazers_count":5,"watchers_count":5,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":5,"license":null,"forks":2,"open_issues":5,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/VTUL/data-repo/pulls/228"},"html":{"href":"https://github.com/VTUL/data-repo/pull/228"},"issue":{"href":"https://api.github.com/repos/VTUL/data-repo/issues/228"},"comments":{"href":"https://api.github.com/repos/VTUL/data-repo/issues/228/comments"},"review_comments":{"href":"https://api.github.com/repos/VTUL/data-repo/pulls/228/comments"},"review_comment":{"href":"https://api.github.com/repos/VTUL/data-repo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/VTUL/data-repo/pulls/228/commits"},"statuses":{"href":"https://api.github.com/repos/VTUL/data-repo/statuses/b1a89b952d3db2ace8e50d39162d92e80b56a6e5"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"tingtingjh"}}