Class: Scholarsphere::Client::Upload
- Inherits:
-
Object
- Object
- Scholarsphere::Client::Upload
- Defined in:
- lib/scholarsphere/client/upload.rb
Overview
Requests a pre-signed url, id, and prefix from Scholarsphere for uploading a given file. In order to generate a correct path, the file's extension name is required for the request. The url is used to upload the file's binary content into Scholarsphere, while the id and key are used when adding the file to a work.
Instance Method Summary collapse
-
#id ⇒ String
A unique identifier for the file which will serve as its name in S3.
-
#initialize(extname:, content_md5:) ⇒ Upload
constructor
A new instance of Upload.
-
#prefix ⇒ String
Prefix where the file is stored in the S3 bucket.
-
#url ⇒ String
URL for uploading the file into AWS.
Constructor Details
#initialize(extname:, content_md5:) ⇒ Upload
Returns a new instance of Upload.
14 15 16 17 |
# File 'lib/scholarsphere/client/upload.rb', line 14 def initialize(extname:, content_md5:) @extname = extname @content_md5 = content_md5 end |
Instance Method Details
#id ⇒ String
Returns A unique identifier for the file which will serve as its name in S3.
30 31 32 |
# File 'lib/scholarsphere/client/upload.rb', line 30 def id data['id'] end |
#prefix ⇒ String
Returns Prefix where the file is stored in the S3 bucket.
20 21 22 |
# File 'lib/scholarsphere/client/upload.rb', line 20 def prefix data['prefix'] end |
#url ⇒ String
Returns URL for uploading the file into AWS.
25 26 27 |
# File 'lib/scholarsphere/client/upload.rb', line 25 def url data['url'] end |