diff --git a/lib/google_drive/file.rb b/lib/google_drive/file.rb index 23c76b89..5b64a7c7 100644 --- a/lib/google_drive/file.rb +++ b/lib/google_drive/file.rb @@ -36,7 +36,7 @@ def initialize(session, api_file) # Reloads file metadata such as title and acl. def reload_metadata - @api_file = @session.drive.get_file(id, fields: '*') + @api_file = @session.drive.get_file(id, fields: '*', supports_team_drives: true) @acl = Acl.new(@session, self) if @acl end @@ -87,7 +87,9 @@ def available_content_types # # To export the file in other formats, use export_as_file. def download_to_file(path, params = {}) - @session.drive.get_file(id, {download_dest: path}.merge(params)) + @session.drive.get_file( + id, + {download_dest: path, supports_team_drives: true}.merge(params)) end # Downloads the file and returns as a String. @@ -103,7 +105,9 @@ def download_to_string(params = {}) # # To export the file in other formats, use export_to_io. def download_to_io(io, params = {}) - @session.drive.get_file(id, {download_dest: io}.merge(params)) + @session.drive.get_file( + id, + {download_dest: io, supports_team_drives: true}.merge(params)) end # Export the file to +path+ in content type +format+. diff --git a/lib/google_drive/session.rb b/lib/google_drive/session.rb index 3fe02bb8..9faf3e50 100644 --- a/lib/google_drive/session.rb +++ b/lib/google_drive/session.rb @@ -186,7 +186,7 @@ def files(params = {}, &block) params = convert_params(params) execute_paged!( method: self.drive.method(:list_files), - parameters: {fields: '*'}.merge(params), + parameters: {fields: '*', supports_team_drives: true}.merge(params), items_method_name: :files, converter: proc { |af| wrap_api_file(af) }, &block) @@ -213,7 +213,7 @@ def file_by_title(title) # Returns an instance of GoogleDrive::File or its subclass (GoogleDrive::Spreadsheet, # GoogleDrive::Collection). def file_by_id(id) - api_file = self.drive.get_file(id, fields: '*') + api_file = self.drive.get_file(id, fields: '*', supports_team_drives: true) wrap_api_file(api_file) end