Class: Bkblz::Task::UploadFile
- Defined in:
- lib/bkblz/task/upload_file.rb
Constant Summary
Constants included from ClassMethods
Instance Attribute Summary
Attributes inherited from BaseTask
Instance Method Summary collapse
Methods inherited from BaseTask
Methods included from ClassMethods
#check_one_of, #check_params, #check_required, #run, #task_param, #task_params
Methods included from TaskHelpers
Constructor Details
This class inherits a constructor from Bkblz::Task::BaseTask
Instance Method Details
#run_internal(session, params) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/bkblz/task/upload_file.rb', line 8 def run_internal(session, params) f = ::File.new(params[:file_path], "r") bucket = find_bucket_by_name session, params[:bucket_name] upload_auth = session.send( Bkblz::V1::GetUploadUrlRequest.new bucket.bucket_id).to_model file_name = ::File.basename f.path file_body = f.read mtime_millis = f.mtime.to_i * 1000 upload_file_info = session.send( Bkblz::V1::UploadFileRequest.new upload_auth, file_body, file_name, nil, mtime_millis).to_model end |