Class: S3::MultipartListRequest
- Defined in:
- lib/s3/multipart_list_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
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/s3/multipart_list_request.rb', line 23 def parse_response( body ) document = parse_xml( body ) document.remove_namespaces! uploads = document.xpath( '//Upload' ).map do | node | { key: node.at( 'Key' )&.text, upload_id: node.at( 'UploadId' )&.text, initiated: Helpers.parse_iso8601( node.at( 'Initiated' )&.text ), storage_class: node.at( 'StorageClass' )&.text } end { bucket: document.at( '//Bucket' )&.text, uploads: uploads, is_truncated: document.at( '//IsTruncated' )&.text == 'true', next_key_marker: document.at( '//NextKeyMarker' )&.text, next_upload_id_marker: document.at( '//NextUploadIdMarker' )&.text } end |
#submit(options = nil, bucket:, **kwargs) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/s3/multipart_list_request.rb', line 3 def submit( = nil, bucket:, **kwargs ) path = "/#{ bucket }" = ( , kwargs, MultipartListOptions ) params = { 'uploads' => '' } params[ 'prefix' ] = [ :prefix ] if [ :prefix ] params[ 'key-marker' ] = [ :key_marker ] if [ :key_marker ] params[ 'upload-id-marker' ] = [ :upload_id_marker ] if [ :upload_id_marker ] params[ 'max-uploads' ] = [ :max_uploads ].to_s if [ :max_uploads ] query = Helpers.build_query_string( params ) response = get( path, query: query ) build_result( response, MultipartListResult ) do MultipartListResult.new( parse_response( response.body ) ) end end |