Dropbox Explorer

Explore Dropbox folders and download files

Installation

Add this line to your application's Gemfile:

gem 'dropbox-explorer'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dropbox-explorer

Usage

Authorize Access to Dropbox

After creating a Dropbox app you must get an authorization. For this process you should have a "App key" and "App secret", and send the type of app (There are two types of Dropbox apps: App folder or Full Dropbox dropbox apps). The rake task will use "dropbox" as default.

$ rake dropbox:authorize APP_KEY=your_app_key APP_SECRET=your_app_secret ACCESS_TYPE=dropbox|app_folder

This rake task will return an URL which you must visit to trigger the authorization process. Follow the instructions and you will have access to the following information:

access_token: #{session.access_token.key}
access_token_secret: #{session.access_token.secret}
user_id: #{user_id}

This info should be added to the config/dropbox.yml file:

app_key: "..."
app_secret: "..."
access_token: "..."
access_token_secret: "..."
user_id: "..."
access_type: "dropbox|app_folder"

Explore files and folders

  • :config_path – String, the config file path
  • :only_files – Boolean, for returning only files (optional - default returns files and folders)
client = Dropbox::Explorer::Client.new(config_path: File.join(Rails.root, '/config/dropbox.yml'))
files = client.contents_in_path('/', only_files: true)

Get public URL for file

client.get_file_url(file_path)

License

MIT