Class: Google::APIClient::UploadIO

Inherits:
Faraday::UploadIO
  • 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



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

def chunk_size
  @chunk_size
end

Instance Method Details

#lengthFixnum

Get the length of the stream

Returns:

  • (Fixnum)

    Length of stream, in bytes



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

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