Skip to content

Add root info#79

Merged
Jesus merged 7 commits into
masterfrom
add-root-info
Sep 18, 2021
Merged

Add root info#79
Jesus merged 7 commits into
masterfrom
add-root-info

Conversation

@Jesus

@Jesus Jesus commented Feb 7, 2021

Copy link
Copy Markdown
Owner

No description provided.

dwhenry and others added 5 commits February 7, 2021 18:02
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

Jesus commented Feb 7, 2021

Copy link
Copy Markdown
Owner Author

@dwhenry I don't have a Dropbox business account, so I could only test to a certain point. It'd be awesome if to gather feedback on this branch from people who actually use a business account.

I'll leave this open for a few days in case anyone has suggestions and eventually I'll merge it.

@kmuto

kmuto commented Mar 12, 2021

Copy link
Copy Markdown

Hi, I tried this branch with my Dropbox business account.
Sadly it failed.

sample code

#!/usr/bin/ruby
$LOAD_PATH.unshift("./lib") # for use local git version 
require 'dropbox_api'
client = DropboxApi::Client.new("...")
client.namespace_id = client.get_current_account.root_info.root_namespace_id

folder = client.list_folder('')

result (ruby 2.5.5p157)

Traceback (most recent call last):
	4: from dropboxapi.rb:8:in `<main>'
	3: from dropbox_api/lib/dropbox_api/client.rb:23:in `block in add_endpoint'
	2: from dropbox_api/lib/dropbox_api/endpoints/files/list_folder.rb:44:in `block in <class:ListFolder>'
	1: from dropbox_api/lib/dropbox_api/endpoints/base.rb:12:in `perform_request'
dropbox_api/lib/dropbox_api/endpoints/base.rb:37:in `process_response': HTTP 400: Error in call to API function "files/list_folder": Dropbox-API-Path-Root: unknown tag '#<DropboxApi::Metadata::NamespaceId:0x000056279ea03d60>' (DropboxApi::Errors::HttpError)

I'll try to dig more.

Comment thread lib/dropbox_api/middleware/path_root.rb Outdated
JSON.dump(
DropboxApi::Metadata::NamespaceId.new({
'namespace_id' => namespace_id
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by changing here to }).to_hash, handling team works.

@Nerian

Nerian commented May 28, 2021

Copy link
Copy Markdown

I tried with kmuto's comment: #79 (comment)

It worked fine like this:

dropbox_client ||= DropboxApi::Client.new
dropbox_client.namespace_id = 57567567
dropbox_client.upload 'somefile/at/here', yolo

@Jesus

Jesus commented Sep 18, 2021

Copy link
Copy Markdown
Owner Author

Thanks for the feedback @kmuto & @Nerian

@Jesus Jesus merged commit 0c4c48e into master Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants