Class: Ribose::FileUploader
- Inherits:
-
Object
- Object
- Ribose::FileUploader
- Defined in:
- lib/ribose/file_uploader.rb
Direct Known Subclasses
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
12 13 14 15 16 |
# File 'lib/ribose/file_uploader.rb', line 12 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
33 34 35 |
# File 'lib/ribose/file_uploader.rb', line 33 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
21 22 23 24 25 |
# File 'lib/ribose/file_uploader.rb', line 21 def create = prepare_to_upload response = upload_to_aws_s3() notify_ribose_file_upload_endpoint(response, .fields.key) end |