Commit 936e0f23 authored by Mateus Rambo Strey's avatar Mateus Rambo Strey

add bitstream path in retrieve action

parent 8993e97a
......@@ -2,8 +2,8 @@ module Dspace
module Builders
module TempfileBuilder
def self.build(filename, contents = nil)
file = Tempfile.new([sanitize_filename(filename), File.extname(filename)], encoding: 'ascii-8bit').tap do |f|
def self.build(filename, contents = nil, bitstreams_path = '/tmp')
file = Tempfile.new([sanitize_filename(filename), File.extname(filename)], bitstreams_path, encoding: 'ascii-8bit').tap do |f|
f.write contents
f.close
end
......
......@@ -75,4 +75,4 @@ module Dspace
}
end
end
end
\ No newline at end of file
end
......@@ -54,8 +54,9 @@ module Dspace
end
def retrieve(args={})
bitstreams_path = args.fetch(:bitstreams_path) || nil
bitstream = ResourceKit::ActionInvoker.call(action(:find), self, id: args.fetch(:id))
Dspace::Builders::TempfileBuilder.build(bitstream.name, ResourceKit::ActionInvoker.call(action(:retrieve), self, id: bitstream.id))
Dspace::Builders::TempfileBuilder.build(bitstream.name, ResourceKit::ActionInvoker.call(action(:retrieve), self, id: bitstream.id), bitstreams_path)
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment