Coder Social home page Coder Social logo

dropbox-sdk-ruby's Introduction

Dropbox SDK for Ruby

Gem Version Build Status MIT licensed

This is a small Ruby library for accessing the new Dropbox API. It provides a single class, Dropbox::Client, with methods that map to most of the Dropbox API endpoints. Currently all of the endpoints in the auth, files, and users namespaces are supported. Sharing methods are planned.

Requirements

  • Ruby 2.1.0 or later
  • The http gem

Installation

Run:

gem install dropbox-sdk-v2

Then, in your source files:

require 'dropbox'

Or just add this to your Gemfile:

gem 'dropbox-sdk-v2'

Usage

Also see the full YARD documentation.

Set up a client:

require 'dropbox'

dbx = Dropbox::Client.new(ENV['DROPBOX_ACCESS_TOKEN'])

Create a folder:

folder = dbx.create_folder('/myfolder') # => Dropbox::FolderMetadata
folder.id # => "id:a4ayc_80_OEAAAAAAAAAXz"
folder.name # => "myfolder"
folder.path_lower # => "/myfolder"

Upload a file:

# File body can be a String, File, or any Enumerable.
file = dbx.upload('/myfolder/file.txt', 'file body') # => Dropbox::FileMetadata
file.size # => 9
file.rev # => a1c10ce0dd78

Download a file:

file, body = dbx.download('/myfolder/file.txt') # => Dropbox::FileMetadata, HTTP::Response::Body
body.to_s # => "file body"

Delete a file:

dbx.delete('/myfolder/file.txt') # => Dropbox::FileMetadata

Contributing

All contributions are welcome. Please file an issue or submit a pull request.

This project strives for full test coverage. To run the test suite, make a Dropbox App with "app folder" access and generate an access token. Then run DROPBOX_SDK_ACCESS_TOKEN="..." rake test.

dropbox-sdk-ruby's People

Contributors

waits avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.