Support Shared Drives
Feature request: Add support for shared drives. If this is available now, I wasn't able to find documentation for it.
It looks like Team Drive support was added a couple of years ago (https://github.com/gimite/google-drive-ruby/issues/259). Team Drive has since been renamed to "Shared Drives." The API documentation mentions a supportsAllDrives parameter that must be passed along with various requests, which might be the new version of the supports_team_drives parameter added at the time and still extant in v3.0.3 of the gem.
Thanks!
With v3.0.5, I got shared drives to work. Currently it doesn't work because the drive ID is hard-coded to root here: https://github.com/gimite/google-drive-ruby/blob/264a0001c1896dcf92d0227bf66e75eb1909448c/lib/google_drive/session.rb#L414
I monkey patched this to the following:
module GoogleDrive
# Monkey patches google-drive-ruby to support shared drives
class Session
def root_collection
@root_collection ||= file_by_id(ENV['GOOGLE_DRIVE_ID'])
end
end
end
Hi, I don't think monkey patching is needed, it's not documented in the README, but it is possible to upload to shared GDrive folders ("collections" as per this library's source code):
GoogleDrive::Session
.from_service_account_key(CONFIG)
.collection_by_url("https://drive.google.com/drive/folders/gF1dvxQfFeRcQgFOdgid0aAcM1q9i6K15")
.upload_from_file(file)
Make sure to share to the client_email (when using a service), as documented here.