class Google::Apis::Core::MultipartUploadCommand

Implementation of the multipart upload protocol

Constants

MULTIPART_PROTOCOL
UPLOAD_BOUNDARY

Public Instance Methods

prepare!() click to toggle source

Encode the multipart request

@return [void] @raise [Google::Apis::ClientError] if upload source is invalid

# File lib/google/apis/core/upload.rb, line 135
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