Class: Google::Apis::Core::MultipartUploadCommand

Inherits:
BaseUploadCommand show all
Defined in:
lib/google/apis/core/upload.rb

Overview

Implementation of the multipart upload protocol

Constant Summary collapse

UPLOAD_BOUNDARY =
'RubyApiClientUpload'
MULTIPART_PROTOCOL =
'multipart'
'multipart/related'

Constants inherited from ApiCommand

ApiCommand::FIELDS_PARAM, ApiCommand::JSON_CONTENT_TYPE, ApiCommand::RATE_LIMIT_ERRORS

Constants inherited from HttpCommand

HttpCommand::RETRIABLE_ERRORS

Instance Attribute Summary

Attributes inherited from ApiCommand

#request_object, #request_representation, #response_class, #response_representation

Attributes inherited from HttpCommand

#body, #connection, #header, #method, #options, #params, #query, #url

Instance Method Summary collapse

Methods inherited from ApiCommand

#check_status, #decode_response_body

Methods inherited from HttpCommand

#apply_request_options, #authorization_refreshable?, #check_status, #decode_response_body, #error, #execute, #initialize, #process_response, #success

Methods included from Logging

#logger

Constructor Details

This class inherits a constructor from Google::Apis::Core::HttpCommand

Instance Method Details

#prepare!

This method returns an undefined value.

Encode the multipart request

Raises:



141
142
143
144
145
146
147
148
149
# File 'lib/google/apis/core/upload.rb', line 141

def prepare!
  super
  @multipart = Multipart.new(boundary: UPLOAD_BOUNDARY, content_type: MULTIPART_RELATED)
  @multipart.add_json(body)
  @multipart.add_upload(upload_io)
  self.body = @multipart.assemble
  header[:content_type] = @multipart.content_type
  header[UPLOAD_PROTOCOL_HEADER] = MULTIPART_PROTOCOL
end