Skip to content

Commit

Permalink
Support team drive files. #259
Browse files Browse the repository at this point in the history
  • Loading branch information
gimite committed May 24, 2017
1 parent 61df9f9 commit 3ee8d0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions lib/google_drive/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -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+.
Expand Down
4 changes: 2 additions & 2 deletions lib/google_drive/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down

0 comments on commit 3ee8d0e

Please sign in to comment.