module AriesRubyUtils
Constants
- VERSION
Public Class Methods
s3_input(s3_key)
click to toggle source
# File lib/aries_ruby_utils.rb, line 23 def self.s3_input(s3_key) tmp_filepath = File.join(ENV['TEMP_FILE_DIR'], 'input') File.open(tmp_filepath, 'wb') do |file| s3 = Aws::S3::Client.new s3.get_object({ bucket: ENV['AWS_S3_TEMP_BUCKET'], key: s3_key }, target: file) end return tmp_filepath end
s3_output(path)
click to toggle source
# File lib/aries_ruby_utils.rb, line 12 def self.s3_output(path) filename = SecureRandom.uuid s3 = Aws::S3::Resource.new(region: ENV['AWS_REGION']) obj = s3.bucket(ENV['AWS_S3_TEMP_BUCKET']).object(filename) obj.upload_file(path) output = { :input => { :key => filename } } return JSON.generate(output).strip end