Method: FileConvert::Conversion#initialize
- Defined in:
- lib/file_convert/conversion.rb
#initialize(client, remote_file, mime_type) ⇒ FileConvert::File
Downloads remote file from Google Drive with given mime_type
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/file_convert/conversion.rb', line 15 def initialize(client, remote_file, mime_type) @client = client @remote_file = remote_file @original_upload_result = remote_file.original_file @remote_file_data = remote_file.data @mime_type = mime_type # Fail if upload errored fail data_error_exception if @original_upload_result.error? # Fail if requested mime-type is not available fail missing_mime_type_exception unless export_links.key?(mime_type) @file = fetch_file @body = @file.body @remote_file.add_conversion(mime_type, self) end |