dropbox-sdk-v2 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/README.md +68 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a2322ad19040f1f574b4417ce7ca0134849ebe7
|
4
|
+
data.tar.gz: 636f09861b9ea96ab8b423da8b3daa257fd159b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc3d5b2ba162d750c1c6cbb462f788d8326b3092637d168754cef442223fdeff6743e582ddf5253a027425a3d7fe17536748a75ca3cfb1567515cb7c7c9b0d5b
|
7
|
+
data.tar.gz: 2daad67a615c21ed801e5638ef164b806eb9c4fc597d6e6df1277c1ba1f8b77fe7bd31ae28a2028da54f186286dd9125ecb8242bccec915310128b5400a1c571
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Dylan Waits
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Dropbox SDK for Ruby
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/waits/dropbox-sdk-ruby.svg?branch=master)](https://travis-ci.org/waits/dropbox-sdk-ruby)
|
4
|
+
|
5
|
+
This is a small Ruby library for accessing the new [Dropbox API](https://www.dropbox.com/developers/documentation/http/overview). 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.
|
6
|
+
|
7
|
+
## Requirements
|
8
|
+
- Ruby 2.1.0 or later
|
9
|
+
- The [http](https://github.com/httprb/http) gem
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Run:
|
14
|
+
```bash
|
15
|
+
gem install dropbox-sdk-v2
|
16
|
+
```
|
17
|
+
|
18
|
+
Then, in your source files:
|
19
|
+
```ruby
|
20
|
+
require 'dropbox'
|
21
|
+
```
|
22
|
+
|
23
|
+
Or just add this to your Gemfile:
|
24
|
+
```ruby
|
25
|
+
gem 'dropbox-sdk-v2'
|
26
|
+
```
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
Set up a client:
|
31
|
+
```ruby
|
32
|
+
require 'dropbox'
|
33
|
+
|
34
|
+
dbx = Dropbox::Client.new(ENV['DROPBOX_ACCESS_TOKEN'])
|
35
|
+
```
|
36
|
+
|
37
|
+
Create a folder:
|
38
|
+
```ruby
|
39
|
+
folder = dbx.create_folder('/myfolder') # => Dropbox::FolderMetadata
|
40
|
+
folder.id # => "id:a4ayc_80_OEAAAAAAAAAXz"
|
41
|
+
folder.name # => "myfolder"
|
42
|
+
folder.path_lower # => "/myfolder"
|
43
|
+
```
|
44
|
+
|
45
|
+
Upload a file:
|
46
|
+
```ruby
|
47
|
+
file = dbx.upload('/myfolder/file.txt', 'the file contents') # Accepts a String or File
|
48
|
+
file.class # => Dropbox::FileMetadata
|
49
|
+
file.size # => 17
|
50
|
+
file.rev # => a1c10ce0dd78
|
51
|
+
```
|
52
|
+
|
53
|
+
Download a file:
|
54
|
+
```ruby
|
55
|
+
file, body = dbx.download('/myfolder/file.txt') # => Dropbox::FileMetadata, HTTP::Response::Body
|
56
|
+
body.to_s # => "the file contents"
|
57
|
+
```
|
58
|
+
|
59
|
+
Delete a file:
|
60
|
+
```ruby
|
61
|
+
dbx.delete('/myfolder/file.txt') # => Dropbox::FileMetadata
|
62
|
+
```
|
63
|
+
|
64
|
+
## Contributing
|
65
|
+
|
66
|
+
All contributions are welcome. Please [file an issue](https://github.com/waits/dropbox-sdk-ruby/issues) or [submit a pull request](https://github.com/waits/dropbox-sdk-ruby/pulls).
|
67
|
+
|
68
|
+
This project strives for full test coverage. To run the test suite, make a [Dropbox App](https://www.dropbox.com/developers/apps) with "app folder" access and generate an access token. Then run `DROPBOX_SDK_ACCESS_TOKEN="..." rake test`.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dropbox-sdk-v2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Waits
|
@@ -44,6 +44,8 @@ executables: []
|
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
|
+
- LICENSE
|
48
|
+
- README.md
|
47
49
|
- lib/dropbox.rb
|
48
50
|
- lib/dropbox/account.rb
|
49
51
|
- lib/dropbox/client.rb
|