Class: Etna::Clients::Metis::MetisUploadWorkflow
- Inherits:
-
Struct
- Object
- Struct
- Etna::Clients::Metis::MetisUploadWorkflow
- Defined in:
- lib/etna/clients/metis/workflows/metis_upload_workflow.rb
Defined Under Namespace
Classes: StreamingIOUpload, StreamingUploadError, Upload
Instance Attribute Summary collapse
-
#bucket_name ⇒ Object
Returns the value of attribute bucket_name.
-
#max_attempts ⇒ Object
Returns the value of attribute max_attempts.
-
#metis_client ⇒ Object
Returns the value of attribute metis_client.
-
#metis_uid ⇒ Object
Returns the value of attribute metis_uid.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
Instance Method Summary collapse
- #do_upload(source_file_or_upload, dest_path, &block) ⇒ Object
-
#initialize(args) ⇒ MetisUploadWorkflow
constructor
A new instance of MetisUploadWorkflow.
Constructor Details
#initialize(args) ⇒ MetisUploadWorkflow
Returns a new instance of MetisUploadWorkflow.
17 18 19 |
# File 'lib/etna/clients/metis/workflows/metis_upload_workflow.rb', line 17 def initialize(args) super({max_attempts: 3, metis_uid: SecureRandom.hex}.update(args)) end |
Instance Attribute Details
#bucket_name ⇒ Object
Returns the value of attribute bucket_name
12 13 14 |
# File 'lib/etna/clients/metis/workflows/metis_upload_workflow.rb', line 12 def bucket_name @bucket_name end |
#max_attempts ⇒ Object
Returns the value of attribute max_attempts
12 13 14 |
# File 'lib/etna/clients/metis/workflows/metis_upload_workflow.rb', line 12 def max_attempts @max_attempts end |
#metis_client ⇒ Object
Returns the value of attribute metis_client
12 13 14 |
# File 'lib/etna/clients/metis/workflows/metis_upload_workflow.rb', line 12 def metis_client @metis_client end |
#metis_uid ⇒ Object
Returns the value of attribute metis_uid
12 13 14 |
# File 'lib/etna/clients/metis/workflows/metis_upload_workflow.rb', line 12 def metis_uid @metis_uid end |
#project_name ⇒ Object
Returns the value of attribute project_name
12 13 14 |
# File 'lib/etna/clients/metis/workflows/metis_upload_workflow.rb', line 12 def project_name @project_name end |
Instance Method Details
#do_upload(source_file_or_upload, dest_path, &block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/etna/clients/metis/workflows/metis_upload_workflow.rb', line 21 def do_upload(source_file_or_upload, dest_path, &block) unless source_file_or_upload.is_a?(Upload) upload = Upload.new(source_file: source_file_or_upload) else upload = source_file_or_upload end dir = ::File.dirname(dest_path) metis_client.create_folder(CreateFolderRequest.new( project_name: project_name, bucket_name: bucket_name, folder_path: dir, )) = metis_client.(AuthorizeUploadRequest.new( project_name: project_name, bucket_name: bucket_name, file_path: dest_path, )) upload_parts(upload, .upload_path, &block) end |