Jesus / dropbox_api

Ruby client library for Dropbox API v2
MIT License
171 stars 113 forks source link

Provide ability to access root (team) folders #73

Closed dwhenry closed 3 years ago

dwhenry commented 3 years ago

This requires access to RootInfo object in the get_current_account endpoint with the results being used to set the root namespace on subsequent requests.

@Jesus Can you please reset the VCR cassettes so they get the root_info object, it should all work as I have it working locally with monkey patching. :)

Jesus commented 3 years ago

Hi, thanks for your PR.

I don't like suggesting users of this library to use an interface like this:

namespace_id = client.get_current_account.root_info.root_namespace_id
client.middleware.prepend do |connection|
  connection.headers['Dropbox-API-Path-Root'] = "{\".tag\": \"namespace_id\", \"namespace_id\": \"#{namespace_id}\"}"
end

We could allow this instead:

client.namespace_id = client.get_current_account.root_info.root_namespace_id

What do you think?

Jesus commented 3 years ago

Closing in favor of #79