Skip to content
Snippets Groups Projects
Commit 139c3041 authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Added dspace gem to workers

parent f02dc2a7
No related branches found
No related tags found
No related merge requests found
......@@ -14,12 +14,12 @@ class V1::LearningObjects::ChunksController < ApplicationController
if last_chunk?
combine_file!
attachment = post_file!
render attachment, status: 200
render json: attachment, status: :ok
else
render status: 200
render status: :ok
end
rescue
render status: 500
render status: :internal_server_error
end
private
......
......@@ -7,6 +7,9 @@ class DeleteBitstreamWorker
attachment = LearningObject::Attachment.find(attachment_id)
return false if attachment.blank? || !wait_bitstream(attachment)
# Require dspace gem
Bundler.require(*Rails.groups)
DspaceService.create_client.bitstreams.delete(id: attachment.id_dspace)
end
......
......@@ -11,6 +11,9 @@ class DspaceUploadWorker
return false if learning_object.blank?
# Require dspace gem
Bundler.require(*Rails.groups)
# create attachment
file = File.new(media_path, 'r')
bitstream = dspace.items.add_bitstream(file, id: learning_object.id_dspace, name: File.basename(media_path), description: description)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment