Class: FileConvert::Upload
- Inherits:
-
Object
- Object
- FileConvert::Upload
- Defined in:
- lib/file_convert/upload.rb
Constant Summary collapse
- DEFAULT_PARAMS =
{ 'uploadType' => 'multipart', 'convert' => true, 'alt' => 'json' }
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
-
#initialize(client, file_path, mime_type) ⇒ FileConvert::File
constructor
Uploads file to Google Drive.
Constructor Details
#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 |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
9 10 11 |
# File 'lib/file_convert/upload.rb', line 9 def file @file end |