Method: FileConvert::Upload#initialize

Defined in:
lib/file_convert/upload.rb

#initialize(client, file_path, mime_type) ⇒ FileConvert::File

Uploads file to Google Drive



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/file_convert/upload.rb', line 21

def initialize(client, file_path, mime_type)
  @client = client
  @file_path = file_path
  @mime_type = mime_type

  uploaded_file = client.execute(
    api_method: client.drive.files.insert,
    body_object: touch_file,
    media: upload_io,
    parameters: DEFAULT_PARAMS
  )

  @file = FileConvert::File.new(uploaded_file)
end