Class: S3::MultipartCreateRequest
- Defined in:
- lib/s3/multipart_create_request.rb
Constant Summary
Constants inherited from Request
Request::AWS_ALGORITHM, Request::AWS_REQUEST, Request::SERVICE, Request::UNSIGNED_PAYLOAD
Instance Method Summary collapse
Methods inherited from Request
Constructor Details
This class inherits a constructor from S3::Request
Instance Method Details
#parse_response(body) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/s3/multipart_create_request.rb', line 25 def parse_response( body ) document = parse_xml( body ) document.remove_namespaces! { bucket: document.at( '//Bucket' )&.text, key: document.at( '//Key' )&.text, upload_id: document.at( '//UploadId' )&.text } end |
#submit(options = nil, bucket:, key:, **kwargs) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/s3/multipart_create_request.rb', line 3 def submit( = nil, bucket:, key:, **kwargs ) path = "/#{ bucket }/#{ Helpers.encode_key( key ) }" query = 'uploads=' = ( , kwargs, MultipartCreateOptions ) headers = {} headers[ 'Content-Type' ] = [ :content_type ] if [ :content_type ] headers[ 'x-amz-acl' ] = [ :acl ] if [ :acl ] headers[ 'x-amz-storage-class' ] = [ :storage_class ] if [ :storage_class ] [ :metadata ]&.each do | , value | headers[ "x-amz-meta-#{ }" ] = value.to_s end response = post( path, query: query, headers: headers ) build_result( response, MultipartCreateResult ) do MultipartCreateResult.new( parse_response( response.body ) ) end end |