Class: Google::APIClient::UploadIO

Inherits:
Faraday::Multipart::FilePart
  • Object
show all
Defined in:
lib/google/api_client/media.rb

Overview

Uploadable media support. Holds an IO stream & content type.

Examples:

media = Google::APIClient::UploadIO.new('mymovie.m4v', 'video/mp4')

See Also:

  • Faraday::UploadIO

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#chunk_sizeFixnum

Returns Size of chunks to upload. Default is nil, meaning upload the entire file in a single request.

Returns:

  • (Fixnum)

    Size of chunks to upload. Default is nil, meaning upload the entire file in a single request



28
29
30
# File 'lib/google/api_client/media.rb', line 28

def chunk_size
  @chunk_size
end

Instance Method Details

#lengthFixnum

Get the length of the stream

Returns:

  • (Fixnum)

    Length of stream, in bytes



35
36
37
# File 'lib/google/api_client/media.rb', line 35

def length
  io.respond_to?(:length) ? io.length : File.size(local_path)
end