Method: Google::Apis::DocsV1::DocsService#create_document

Defined in:
lib/google/apis/docs_v1/service.rb

#create_document(document_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::DocsV1::Document

Creates a blank document using the title given in the request. Other fields in the request, including any provided content, are ignored. Returns the created document.

Parameters:

  • document_object (Google::Apis::DocsV1::Document) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



120
121
122
123
124
125
126
127
128
129
# File 'lib/google/apis/docs_v1/service.rb', line 120

def create_document(document_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/documents', options)
  command.request_representation = Google::Apis::DocsV1::Document::Representation
  command.request_object = document_object
  command.response_representation = Google::Apis::DocsV1::Document::Representation
  command.response_class = Google::Apis::DocsV1::Document
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end