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

MULTIPART_PROTOCOL =
'multipart'
'multipart/related'

Constants inherited from ApiCommand

ApiCommand::ERROR_REASON_MAPPING, ApiCommand::FIELDS_PARAM, ApiCommand::JSON_CONTENT_TYPE

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

#allow_form_encoding?, #check_status, #decode_response_body

Methods inherited from HttpCommand

#allow_form_encoding?, #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:



107
108
109
110
111
112
113
114
115
# File 'lib/google/apis/core/upload.rb', line 107

def prepare!
  super
  multipart = Multipart.new
  multipart.add_json(body)
  multipart.add_upload(upload_io, content_type: upload_content_type)
  self.body = multipart.assemble
  header['Content-Type'] = multipart.content_type
  header[UPLOAD_PROTOCOL_HEADER] = MULTIPART_PROTOCOL
end