{"action":"created","comment":{"url":"https://api.github.com/repos/samvera-labs/valkyrie/pulls/comments/127204224","pull_request_review_id":49763266,"id":127204224,"diff_hunk":"@@ -36,6 +36,73 @@ def self.find_by(id:)\n       end.find_by(id: id)\n     end\n \n+    class Fedora\n+      attr_reader :connection\n+      PROTOCOL = 'fedora://'\n+      def initialize(connection:)\n+        @connection = connection\n+      end\n+\n+      # @param id [Valkyrie::ID]\n+      # @return [Boolean] true if this adapter can handle this type of identifer\n+      def handles?(id:)\n+        id.to_s.start_with?(PROTOCOL)\n+      end\n+\n+      # Return the file associated with the given identifier\n+      # @param id [Valkyrie::ID]\n+      # @return [Valkyrie::StorageAdapter::File]\n+      def find_by(id:)\n+        File.new(id: id, io: response(id: id))\n+      end\n+\n+      # @param file [IO]\n+      # @param model [Valkyrie::Model]\n+      # @return [Valkyrie::StorageAdapter::File]\n+      def upload(file:, model:)\n+        # TODO: this is a very naive aproach. Change to PCDM\n+        identifier = model.id.to_uri + '/original'\n+        ActiveFedora::File.new(identifier) do |af|\n+          af.content = file\n+          af.save!\n+          af.metadata.set_value(:type, af.metadata.type + [::RDF::URI('http://pcdm.org/use#OriginalFile')])\n+          af.metadata.save\n+        end\n+        find_by(id: Valkyrie::ID.new(identifier.to_s.sub(/^.+\\/\\//, PROTOCOL)))\n+      end\n+\n+      class IOProxy\n+        # @param faraday_response [Faraday::Response]\n+        def initialize(faraday_response)\n+          @faraday_response = faraday_response\n+        end\n+        delegate :read, to: :io\n+\n+        # There is no streaming support in faraday (https://github.com/lostisland/faraday/pull/604)","path":"valkyrie/lib/valkyrie/storage_adapter.rb","position":46,"original_position":46,"commit_id":"ddf8fb1b775d63e4f64b939ae7b2a839fe84e626","original_commit_id":"ddf8fb1b775d63e4f64b939ae7b2a839fe84e626","user":{"login":"escowles","id":856924,"avatar_url":"https://avatars0.githubusercontent.com/u/856924?v=3","gravatar_id":"","url":"https://api.github.com/users/escowles","html_url":"https://github.com/escowles","followers_url":"https://api.github.com/users/escowles/followers","following_url":"https://api.github.com/users/escowles/following{/other_user}","gists_url":"https://api.github.com/users/escowles/gists{/gist_id}","starred_url":"https://api.github.com/users/escowles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/escowles/subscriptions","organizations_url":"https://api.github.com/users/escowles/orgs","repos_url":"https://api.github.com/users/escowles/repos","events_url":"https://api.github.com/users/escowles/events{/privacy}","received_events_url":"https://api.github.com/users/escowles/received_events","type":"User","site_admin":false},"body":"😞 \r\n\r\nOutside the scope of this ticket, so I've opened a separate ticket to support streaming binary content out of Fedora: #145","created_at":"2017-07-13T12:38:22Z","updated_at":"2017-07-13T12:38:22Z","html_url":"https://github.com/samvera-labs/valkyrie/pull/119#discussion_r127204224","pull_request_url":"https://api.github.com/repos/samvera-labs/valkyrie/pulls/119","_links":{"self":{"href":"https://api.github.com/repos/samvera-labs/valkyrie/pulls/comments/127204224"},"html":{"href":"https://github.com/samvera-labs/valkyrie/pull/119#discussion_r127204224"},"pull_request":{"href":"https://api.github.com/repos/samvera-labs/valkyrie/pulls/119"}}},"pull_request":{"url":"https://api.github.com/repos/samvera-labs/valkyrie/pulls/119","id":129968649,"html_url":"https://github.com/samvera-labs/valkyrie/pull/119","diff_url":"https://github.com/samvera-labs/valkyrie/pull/119.diff","patch_url":"https://github.com/samvera-labs/valkyrie/pull/119.patch","issue_url":"https://api.github.com/repos/samvera-labs/valkyrie/issues/119","number":119,"state":"open","locked":false,"title":"Fedora storage adapter","user":{"login":"jcoyne","id":92044,"avatar_url":"https://avatars1.githubusercontent.com/u/92044?v=3","gravatar_id":"","url":"https://api.github.com/users/jcoyne","html_url":"https://github.com/jcoyne","followers_url":"https://api.github.com/users/jcoyne/followers","following_url":"https://api.github.com/users/jcoyne/following{/other_user}","gists_url":"https://api.github.com/users/jcoyne/gists{/gist_id}","starred_url":"https://api.github.com/users/jcoyne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcoyne/subscriptions","organizations_url":"https://api.github.com/users/jcoyne/orgs","repos_url":"https://api.github.com/users/jcoyne/repos","events_url":"https://api.github.com/users/jcoyne/events{/privacy}","received_events_url":"https://api.github.com/users/jcoyne/received_events","type":"User","site_admin":false},"body":"Fixes #87","created_at":"2017-07-11T17:55:29Z","updated_at":"2017-07-13T12:38:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b99f5c9ab3051bb84452c8ac58b5afbb87257e8","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/samvera-labs/valkyrie/pulls/119/commits","review_comments_url":"https://api.github.com/repos/samvera-labs/valkyrie/pulls/119/comments","review_comment_url":"https://api.github.com/repos/samvera-labs/valkyrie/pulls/comments{/number}","comments_url":"https://api.github.com/repos/samvera-labs/valkyrie/issues/119/comments","statuses_url":"https://api.github.com/repos/samvera-labs/valkyrie/statuses/ddf8fb1b775d63e4f64b939ae7b2a839fe84e626","head":{"label":"samvera-labs:fedora_adapter","ref":"fedora_adapter","sha":"ddf8fb1b775d63e4f64b939ae7b2a839fe84e626","user":{"login":"samvera-labs","id":7377013,"avatar_url":"https://avatars1.githubusercontent.com/u/7377013?v=3","gravatar_id":"","url":"https://api.github.com/users/samvera-labs","html_url":"https://github.com/samvera-labs","followers_url":"https://api.github.com/users/samvera-labs/followers","following_url":"https://api.github.com/users/samvera-labs/following{/other_user}","gists_url":"https://api.github.com/users/samvera-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/samvera-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samvera-labs/subscriptions","organizations_url":"https://api.github.com/users/samvera-labs/orgs","repos_url":"https://api.github.com/users/samvera-labs/repos","events_url":"https://api.github.com/users/samvera-labs/events{/privacy}","received_events_url":"https://api.github.com/users/samvera-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":66685502,"name":"valkyrie","full_name":"samvera-labs/valkyrie","owner":{"login":"samvera-labs","id":7377013,"avatar_url":"https://avatars1.githubusercontent.com/u/7377013?v=3","gravatar_id":"","url":"https://api.github.com/users/samvera-labs","html_url":"https://github.com/samvera-labs","followers_url":"https://api.github.com/users/samvera-labs/followers","following_url":"https://api.github.com/users/samvera-labs/following{/other_user}","gists_url":"https://api.github.com/users/samvera-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/samvera-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samvera-labs/subscriptions","organizations_url":"https://api.github.com/users/samvera-labs/orgs","repos_url":"https://api.github.com/users/samvera-labs/repos","events_url":"https://api.github.com/users/samvera-labs/events{/privacy}","received_events_url":"https://api.github.com/users/samvera-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/samvera-labs/valkyrie","description":"A proof of concept \"breakable toy\" for enabling multiple backends for storage of files and metadata in Samvera.","fork":false,"url":"https://api.github.com/repos/samvera-labs/valkyrie","forks_url":"https://api.github.com/repos/samvera-labs/valkyrie/forks","keys_url":"https://api.github.com/repos/samvera-labs/valkyrie/keys{/key_id}","collaborators_url":"https://api.github.com/repos/samvera-labs/valkyrie/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/samvera-labs/valkyrie/teams","hooks_url":"https://api.github.com/repos/samvera-labs/valkyrie/hooks","issue_events_url":"https://api.github.com/repos/samvera-labs/valkyrie/issues/events{/number}","events_url":"https://api.github.com/repos/samvera-labs/valkyrie/events","assignees_url":"https://api.github.com/repos/samvera-labs/valkyrie/assignees{/user}","branches_url":"https://api.github.com/repos/samvera-labs/valkyrie/branches{/branch}","tags_url":"https://api.github.com/repos/samvera-labs/valkyrie/tags","blobs_url":"https://api.github.com/repos/samvera-labs/valkyrie/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/samvera-labs/valkyrie/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/samvera-labs/valkyrie/git/refs{/sha}","trees_url":"https://api.github.com/repos/samvera-labs/valkyrie/git/trees{/sha}","statuses_url":"https://api.github.com/repos/samvera-labs/valkyrie/statuses/{sha}","languages_url":"https://api.github.com/repos/samvera-labs/valkyrie/languages","stargazers_url":"https://api.github.com/repos/samvera-labs/valkyrie/stargazers","contributors_url":"https://api.github.com/repos/samvera-labs/valkyrie/contributors","subscribers_url":"https://api.github.com/repos/samvera-labs/valkyrie/subscribers","subscription_url":"https://api.github.com/repos/samvera-labs/valkyrie/subscription","commits_url":"https://api.github.com/repos/samvera-labs/valkyrie/commits{/sha}","git_commits_url":"https://api.github.com/repos/samvera-labs/valkyrie/git/commits{/sha}","comments_url":"https://api.github.com/repos/samvera-labs/valkyrie/comments{/number}","issue_comment_url":"https://api.github.com/repos/samvera-labs/valkyrie/issues/comments{/number}","contents_url":"https://api.github.com/repos/samvera-labs/valkyrie/contents/{+path}","compare_url":"https://api.github.com/repos/samvera-labs/valkyrie/compare/{base}...{head}","merges_url":"https://api.github.com/repos/samvera-labs/valkyrie/merges","archive_url":"https://api.github.com/repos/samvera-labs/valkyrie/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/samvera-labs/valkyrie/downloads","issues_url":"https://api.github.com/repos/samvera-labs/valkyrie/issues{/number}","pulls_url":"https://api.github.com/repos/samvera-labs/valkyrie/pulls{/number}","milestones_url":"https://api.github.com/repos/samvera-labs/valkyrie/milestones{/number}","notifications_url":"https://api.github.com/repos/samvera-labs/valkyrie/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/samvera-labs/valkyrie/labels{/name}","releases_url":"https://api.github.com/repos/samvera-labs/valkyrie/releases{/id}","deployments_url":"https://api.github.com/repos/samvera-labs/valkyrie/deployments","created_at":"2016-08-26T23:37:15Z","updated_at":"2017-07-06T18:51:07Z","pushed_at":"2017-07-13T00:16:15Z","git_url":"git://github.com/samvera-labs/valkyrie.git","ssh_url":"git@github.com:samvera-labs/valkyrie.git","clone_url":"https://github.com/samvera-labs/valkyrie.git","svn_url":"https://github.com/samvera-labs/valkyrie","homepage":"","size":1221,"stargazers_count":6,"watchers_count":6,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":32,"forks":4,"open_issues":32,"watchers":6,"default_branch":"master"}},"base":{"label":"samvera-labs:master","ref":"master","sha":"42eeddbe3823848d6c1c83139ef6ddc149ba5660","user":{"login":"samvera-labs","id":7377013,"avatar_url":"https://avatars1.githubusercontent.com/u/7377013?v=3","gravatar_id":"","url":"https://api.github.com/users/samvera-labs","html_url":"https://github.com/samvera-labs","followers_url":"https://api.github.com/users/samvera-labs/followers","following_url":"https://api.github.com/users/samvera-labs/following{/other_user}","gists_url":"https://api.github.com/users/samvera-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/samvera-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samvera-labs/subscriptions","organizations_url":"https://api.github.com/users/samvera-labs/orgs","repos_url":"https://api.github.com/users/samvera-labs/repos","events_url":"https://api.github.com/users/samvera-labs/events{/privacy}","received_events_url":"https://api.github.com/users/samvera-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":66685502,"name":"valkyrie","full_name":"samvera-labs/valkyrie","owner":{"login":"samvera-labs","id":7377013,"avatar_url":"https://avatars1.githubusercontent.com/u/7377013?v=3","gravatar_id":"","url":"https://api.github.com/users/samvera-labs","html_url":"https://github.com/samvera-labs","followers_url":"https://api.github.com/users/samvera-labs/followers","following_url":"https://api.github.com/users/samvera-labs/following{/other_user}","gists_url":"https://api.github.com/users/samvera-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/samvera-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samvera-labs/subscriptions","organizations_url":"https://api.github.com/users/samvera-labs/orgs","repos_url":"https://api.github.com/users/samvera-labs/repos","events_url":"https://api.github.com/users/samvera-labs/events{/privacy}","received_events_url":"https://api.github.com/users/samvera-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/samvera-labs/valkyrie","description":"A proof of concept \"breakable toy\" for enabling multiple backends for storage of files and metadata in Samvera.","fork":false,"url":"https://api.github.com/repos/samvera-labs/valkyrie","forks_url":"https://api.github.com/repos/samvera-labs/valkyrie/forks","keys_url":"https://api.github.com/repos/samvera-labs/valkyrie/keys{/key_id}","collaborators_url":"https://api.github.com/repos/samvera-labs/valkyrie/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/samvera-labs/valkyrie/teams","hooks_url":"https://api.github.com/repos/samvera-labs/valkyrie/hooks","issue_events_url":"https://api.github.com/repos/samvera-labs/valkyrie/issues/events{/number}","events_url":"https://api.github.com/repos/samvera-labs/valkyrie/events","assignees_url":"https://api.github.com/repos/samvera-labs/valkyrie/assignees{/user}","branches_url":"https://api.github.com/repos/samvera-labs/valkyrie/branches{/branch}","tags_url":"https://api.github.com/repos/samvera-labs/valkyrie/tags","blobs_url":"https://api.github.com/repos/samvera-labs/valkyrie/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/samvera-labs/valkyrie/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/samvera-labs/valkyrie/git/refs{/sha}","trees_url":"https://api.github.com/repos/samvera-labs/valkyrie/git/trees{/sha}","statuses_url":"https://api.github.com/repos/samvera-labs/valkyrie/statuses/{sha}","languages_url":"https://api.github.com/repos/samvera-labs/valkyrie/languages","stargazers_url":"https://api.github.com/repos/samvera-labs/valkyrie/stargazers","contributors_url":"https://api.github.com/repos/samvera-labs/valkyrie/contributors","subscribers_url":"https://api.github.com/repos/samvera-labs/valkyrie/subscribers","subscription_url":"https://api.github.com/repos/samvera-labs/valkyrie/subscription","commits_url":"https://api.github.com/repos/samvera-labs/valkyrie/commits{/sha}","git_commits_url":"https://api.github.com/repos/samvera-labs/valkyrie/git/commits{/sha}","comments_url":"https://api.github.com/repos/samvera-labs/valkyrie/comments{/number}","issue_comment_url":"https://api.github.com/repos/samvera-labs/valkyrie/issues/comments{/number}","contents_url":"https://api.github.com/repos/samvera-labs/valkyrie/contents/{+path}","compare_url":"https://api.github.com/repos/samvera-labs/valkyrie/compare/{base}...{head}","merges_url":"https://api.github.com/repos/samvera-labs/valkyrie/merges","archive_url":"https://api.github.com/repos/samvera-labs/valkyrie/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/samvera-labs/valkyrie/downloads","issues_url":"https://api.github.com/repos/samvera-labs/valkyrie/issues{/number}","pulls_url":"https://api.github.com/repos/samvera-labs/valkyrie/pulls{/number}","milestones_url":"https://api.github.com/repos/samvera-labs/valkyrie/milestones{/number}","notifications_url":"https://api.github.com/repos/samvera-labs/valkyrie/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/samvera-labs/valkyrie/labels{/name}","releases_url":"https://api.github.com/repos/samvera-labs/valkyrie/releases{/id}","deployments_url":"https://api.github.com/repos/samvera-labs/valkyrie/deployments","created_at":"2016-08-26T23:37:15Z","updated_at":"2017-07-06T18:51:07Z","pushed_at":"2017-07-13T00:16:15Z","git_url":"git://github.com/samvera-labs/valkyrie.git","ssh_url":"git@github.com:samvera-labs/valkyrie.git","clone_url":"https://github.com/samvera-labs/valkyrie.git","svn_url":"https://github.com/samvera-labs/valkyrie","homepage":"","size":1221,"stargazers_count":6,"watchers_count":6,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":32,"forks":4,"open_issues":32,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/samvera-labs/valkyrie/pulls/119"},"html":{"href":"https://github.com/samvera-labs/valkyrie/pull/119"},"issue":{"href":"https://api.github.com/repos/samvera-labs/valkyrie/issues/119"},"comments":{"href":"https://api.github.com/repos/samvera-labs/valkyrie/issues/119/comments"},"review_comments":{"href":"https://api.github.com/repos/samvera-labs/valkyrie/pulls/119/comments"},"review_comment":{"href":"https://api.github.com/repos/samvera-labs/valkyrie/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/samvera-labs/valkyrie/pulls/119/commits"},"statuses":{"href":"https://api.github.com/repos/samvera-labs/valkyrie/statuses/ddf8fb1b775d63e4f64b939ae7b2a839fe84e626"}}}}
{"actor":{"display_login":"escowles"}}