README.md in dbox-0.2.0 vs README.md in dbox-0.3.0
- old
+ new
@@ -60,47 +60,47 @@
```
* This auth token will last for **10 years**, or when you choose to invalidate it, whichever comes first. So you really only need to do this once, and then keep them around.
-Usage
------
+Using dbox from the Command-Line
+--------------------------------
-### Authorize
+### Usage
+#### Authorize
+
```sh
$ dbox authorize
```
-### Create a new Dropbox folder
+#### Create a new Dropbox folder
```sh
$ dbox create <remote_path> [<local_path>]
```
-### Clone an existing Dropbox folder
+#### Clone an existing Dropbox folder
```sh
$ dbox clone <remote_path> [<local_path>]
```
-### Pull (download changes from Dropbox)
+#### Pull (download changes from Dropbox)
```sh
$ dbox pull [<local_path>]
```
-### Push (upload changes to Dropbox)
+#### Push (upload changes to Dropbox)
```sh
$ dbox push [<local_path>]
```
+#### Example
-Example
--------
-
```sh
$ export DROPBOX_APP_KEY=cmlrrjd3j0gbend
$ export DROPBOX_APP_SECRET=uvuulp75xf9jffl
```
@@ -133,6 +133,78 @@
```sh
$ dbox pull
$ cat hello.txt
Oh, Hello
+```
+
+Using dbox from Ruby
+--------------------
+
+### Usage
+
+#### Setup
+
+* Authorize beforehand with the command-line tool
+
+```ruby
+require "dbox"
+```
+
+#### Create a new Dropbox folder
+
+```ruby
+Dbox.create(remote_path, local_path)
+```
+
+#### Clone an existing Dropbox folder
+
+```ruby
+Dbox.clone(remote_path, local_path)
+```
+
+#### Pull (download changes from Dropbox)
+
+```ruby
+Dbox.pull(local_path)
+```
+
+#### Push (upload changes to Dropbox)
+
+```ruby
+Dbox.push(local_path)
+```
+
+#### Example
+
+```sh
+$ export DROPBOX_APP_KEY=cmlrrjd3j0gbend
+$ export DROPBOX_APP_SECRET=uvuulp75xf9jffl
+```
+
+```sh
+$ dbox authorize
+```
+
+```sh
+$ open http://www.dropbox.com/0/oauth/authorize?oauth_token=aaoeuhtns123456
+```
+
+```sh
+$ export DROPBOX_AUTH_KEY=v4d7l1rez1czksn
+$ export DROPBOX_AUTH_SECRET=pqej9rmnj0i1gcxr4
+```
+
+```ruby
+> require "dbox"
+> Dbox.clone("/Public", "/tmp/public")
+> File.open("/tmp/public/hello.txt", "w") {|f| f << "Hello World" }
+> Dbox.push("/tmp/public")
+
+> File.read("#{ENV['HOME']}/Dropbox/Public/hello.txt")
+=> "Hello World"
+> File.open("#{ENV['HOME']}/Dropbox/Public/hello.txt", "w") {|f| f << "Oh, Hello" }
+
+> Dbox.pull("/tmp/public")
+> File.read("#{ENV['HOME']}/Dropbox/Public/hello.txt")
+=> "Oh, Hello"
```