Jesus / dropbox_api

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

Add root info #79

Closed Jesus closed 3 years ago

Jesus commented 3 years ago

@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 commented 3 years ago

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.

Nerian commented 3 years ago

I tried with kmuto's comment: https://github.com/Jesus/dropbox_api/pull/79#discussion_r593135486

It worked fine like this:

dropbox_client ||= DropboxApi::Client.new
dropbox_client.namespace_id = 57567567
dropbox_client.upload 'somefile/at/here', yolo
Jesus commented 3 years ago

Thanks for the feedback @kmuto & @Nerian