Class: Ribose::FileUploader
- Inherits:
-
Object
- Object
- Ribose::FileUploader
- Defined in:
- lib/ribose/file_uploader.rb
Class Method Summary collapse
-
.upload(space_id, file:, **attributes) ⇒ Sawyer::Resource
Create a new upload.
Instance Method Summary collapse
-
#create ⇒ Sawyer::Resource
Create a file upload.
-
#initialize(space_id, file:, **attributes) ⇒ FileUploader
constructor
Initialize the file uploader.
Constructor Details
#initialize(space_id, file:, **attributes) ⇒ FileUploader
Initialize the file uploader
10 11 12 13 14 |
# File 'lib/ribose/file_uploader.rb', line 10 def initialize(space_id, file:, **attributes) @space_id = space_id @file = File.new(file) @attributes = attributes end |
Class Method Details
.upload(space_id, file:, **attributes) ⇒ Sawyer::Resource
Create a new upload
31 32 33 |
# File 'lib/ribose/file_uploader.rb', line 31 def self.upload(space_id, file:, **attributes) new(space_id, attributes.merge(file: file)).create end |
Instance Method Details
#create ⇒ Sawyer::Resource
Create a file upload
19 20 21 22 23 |
# File 'lib/ribose/file_uploader.rb', line 19 def create = prepare_to_upload response = upload_to_aws_s3() notify_ribose_file_upload_endpoint(response, .fields.key) end |