dbox 0.7.6 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/README.md +14 -16
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/dbox.gemspec +6 -15
- data/lib/dbox/api.rb +22 -22
- metadata +85 -97
- data/vendor/dropbox-ruby-sdk/CHANGELOG +0 -42
- data/vendor/dropbox-ruby-sdk/LICENSE +0 -20
- data/vendor/dropbox-ruby-sdk/README +0 -7
- data/vendor/dropbox-ruby-sdk/cli_example.rb +0 -206
- data/vendor/dropbox-ruby-sdk/copy_between_accounts.rb +0 -155
- data/vendor/dropbox-ruby-sdk/dropbox_controller.rb +0 -57
- data/vendor/dropbox-ruby-sdk/gemspec.rb +0 -25
- data/vendor/dropbox-ruby-sdk/lib/dropbox_sdk.rb +0 -883
- data/vendor/dropbox-ruby-sdk/lib/trusted-certs.crt +0 -341
- data/vendor/dropbox-ruby-sdk/search_cache.json +0 -42830
- data/vendor/dropbox-ruby-sdk/search_cache.rb +0 -332
- data/vendor/dropbox-ruby-sdk/web_file_browser.rb +0 -184
data/History.txt
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
== 0.8.9 / 2013-10.28
|
2
|
+
* Using the dropbox-sdk from a gem rather than vendoring it.
|
3
|
+
* Using OAuth2 instead of OAuth1 for authenticating. This means that the environment variables you need are renamed from DROPBOX_AUTH_KEY and DROPBOX_SECRET to DROPBOX_ACCESS_TOKEN.
|
4
|
+
|
1
5
|
== 0.7.6 / 2013-10-02
|
2
6
|
* Bug Fixes
|
3
7
|
* When downloading files, write in binary (issue with Ruby 1.9 running inside Rails environment).
|
data/README.md
CHANGED
@@ -42,35 +42,34 @@ $ export DROPBOX_APP_SECRET=uvuulp75xf9jffl
|
|
42
42
|
```sh
|
43
43
|
$ DROPBOX_APP_KEY=cmlrrjd3j0gbend DROPBOX_APP_SECRET=uvuulp75xf9jffl dbox ...
|
44
44
|
```
|
45
|
-
### Generate an
|
45
|
+
### Generate an access token
|
46
46
|
|
47
47
|
* Make an authorize request:
|
48
48
|
|
49
49
|
```sh
|
50
50
|
$ dbox authorize
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
When you have done so, press [ENTER] to continue.
|
51
|
+
1. Go to: https://www.dropbox.com/1/oauth2/authorize?client_id=1x7xvn1pvas3a3&response_type=code
|
52
|
+
2. Click "Allow" (you might have to log in first)
|
53
|
+
3. Copy the authorization code
|
54
|
+
Enter the authorization code here:
|
56
55
|
```
|
57
56
|
|
58
|
-
* Visit the given URL in your browser, and then go back to the terminal and
|
57
|
+
* Visit the given URL in your browser, and then go back to the terminal and enter the code that Dropbox provides.
|
59
58
|
|
60
59
|
* Now either set the keys as environment variables:
|
61
60
|
|
62
61
|
```sh
|
63
|
-
$ export
|
64
|
-
$ export
|
62
|
+
$ export DROPBOX_ACCESS_TOKEN=aeDsfS4QaReAAAAAAAAAAbZ6nrUUrXZ_Z4Rct2DVTYp6B14N-qiz189gm2VHQqvD
|
63
|
+
$ export DROPBOX_USER_ID=230324561
|
65
64
|
```
|
66
65
|
|
67
|
-
* Or include
|
66
|
+
* Or include the access token in calls to ```dbox```:
|
68
67
|
|
69
68
|
```sh
|
70
|
-
$
|
69
|
+
$ DROPBOX_ACCESS_TOKEN=aeDsfS4QaReAAAAAAAAAAbZ6nrUUrXZ_Z4Rct2DVTYp6B14N-qiz189gm2VHQqvD dbox ...
|
71
70
|
```
|
72
71
|
|
73
|
-
*
|
72
|
+
* The access 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.
|
74
73
|
|
75
74
|
|
76
75
|
Using dbox from the Command-Line
|
@@ -136,8 +135,7 @@ $ open http://www.dropbox.com/0/oauth/authorize?oauth_token=aaoeuhtns123456
|
|
136
135
|
```
|
137
136
|
|
138
137
|
```sh
|
139
|
-
$ export
|
140
|
-
$ export DROPBOX_AUTH_SECRET=pqej9rmnj0i1gcxr4
|
138
|
+
$ export DROPBOX_ACCESS_TOKEN=aeDsfS4QaReAAAAAAAAAAbZ6nrUUrXZ_Z4Rct2DVTYp6B14N-qiz189gm2VHQqvD
|
141
139
|
```
|
142
140
|
|
143
141
|
```sh
|
@@ -245,8 +243,8 @@ $ open http://www.dropbox.com/0/oauth/authorize?oauth_token=aaoeuhtns123456
|
|
245
243
|
```
|
246
244
|
|
247
245
|
```sh
|
248
|
-
$ export
|
249
|
-
$ export
|
246
|
+
$ export DROPBOX_ACCESS_TOKEN=aeDsfS4QaReAAAAAAAAAAbZ6nrUUrXZ_Z4Rct2DVTYp6B14N-qiz189gm2VHQqvD
|
247
|
+
$ export DROPBOX_USER_ID=pqej9rmnj0i1gcxr4
|
250
248
|
```
|
251
249
|
|
252
250
|
```ruby
|
data/Rakefile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
data/dbox.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "dbox"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.8.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ken Pratt"]
|
12
|
-
s.date = "2013-10-
|
12
|
+
s.date = "2013-10-30"
|
13
13
|
s.description = "An easy-to-use Dropbox client with fine-grained control over syncs."
|
14
14
|
s.email = "ken@kenpratt.net"
|
15
15
|
s.executables = ["dbox"]
|
@@ -37,24 +37,12 @@ Gem::Specification.new do |s|
|
|
37
37
|
"sample_polling_script.rb",
|
38
38
|
"spec/dbox_spec.rb",
|
39
39
|
"spec/spec_helper.rb",
|
40
|
-
"vendor/dropbox-ruby-sdk/CHANGELOG",
|
41
|
-
"vendor/dropbox-ruby-sdk/LICENSE",
|
42
|
-
"vendor/dropbox-ruby-sdk/README",
|
43
|
-
"vendor/dropbox-ruby-sdk/cli_example.rb",
|
44
|
-
"vendor/dropbox-ruby-sdk/copy_between_accounts.rb",
|
45
|
-
"vendor/dropbox-ruby-sdk/dropbox_controller.rb",
|
46
|
-
"vendor/dropbox-ruby-sdk/gemspec.rb",
|
47
|
-
"vendor/dropbox-ruby-sdk/lib/dropbox_sdk.rb",
|
48
|
-
"vendor/dropbox-ruby-sdk/lib/trusted-certs.crt",
|
49
|
-
"vendor/dropbox-ruby-sdk/search_cache.json",
|
50
|
-
"vendor/dropbox-ruby-sdk/search_cache.rb",
|
51
|
-
"vendor/dropbox-ruby-sdk/web_file_browser.rb",
|
52
40
|
"vendor/insensitive_hash_patched.rb"
|
53
41
|
]
|
54
42
|
s.homepage = "http://github.com/kenpratt/dbox"
|
55
43
|
s.licenses = ["MIT"]
|
56
44
|
s.require_paths = ["lib"]
|
57
|
-
s.rubygems_version = "1.8.
|
45
|
+
s.rubygems_version = "1.8.23"
|
58
46
|
s.summary = "Dropbox made easy."
|
59
47
|
|
60
48
|
if s.respond_to? :specification_version then
|
@@ -65,17 +53,20 @@ Gem::Specification.new do |s|
|
|
65
53
|
s.add_runtime_dependency(%q<oauth>, [">= 0.4.5"])
|
66
54
|
s.add_runtime_dependency(%q<json>, [">= 1.5.3"])
|
67
55
|
s.add_runtime_dependency(%q<sqlite3>, [">= 1.3.3"])
|
56
|
+
s.add_runtime_dependency(%q<dropbox-sdk>, [">= 1.6.2"])
|
68
57
|
else
|
69
58
|
s.add_dependency(%q<multipart-post>, [">= 1.1.2"])
|
70
59
|
s.add_dependency(%q<oauth>, [">= 0.4.5"])
|
71
60
|
s.add_dependency(%q<json>, [">= 1.5.3"])
|
72
61
|
s.add_dependency(%q<sqlite3>, [">= 1.3.3"])
|
62
|
+
s.add_dependency(%q<dropbox-sdk>, [">= 1.6.2"])
|
73
63
|
end
|
74
64
|
else
|
75
65
|
s.add_dependency(%q<multipart-post>, [">= 1.1.2"])
|
76
66
|
s.add_dependency(%q<oauth>, [">= 0.4.5"])
|
77
67
|
s.add_dependency(%q<json>, [">= 1.5.3"])
|
78
68
|
s.add_dependency(%q<sqlite3>, [">= 1.3.3"])
|
69
|
+
s.add_dependency(%q<dropbox-sdk>, [">= 1.6.2"])
|
79
70
|
end
|
80
71
|
end
|
81
72
|
|
data/lib/dbox/api.rb
CHANGED
@@ -14,22 +14,31 @@ module Dbox
|
|
14
14
|
def self.authorize
|
15
15
|
app_key = ENV["DROPBOX_APP_KEY"]
|
16
16
|
app_secret = ENV["DROPBOX_APP_SECRET"]
|
17
|
-
|
17
|
+
|
18
18
|
raise(ConfigurationError, "Please set the DROPBOX_APP_KEY environment variable to a Dropbox application key") unless app_key
|
19
19
|
raise(ConfigurationError, "Please set the DROPBOX_APP_SECRET environment variable to a Dropbox application secret") unless app_secret
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
puts
|
26
|
-
puts "
|
21
|
+
|
22
|
+
flow = DropboxOAuth2FlowNoRedirect.new(app_key, app_secret)
|
23
|
+
authorize_url = flow.start()
|
24
|
+
|
25
|
+
puts '1. Go to: ' + authorize_url
|
26
|
+
puts '2. Click "Allow" (you might have to log in first)'
|
27
|
+
puts '3. Copy the authorization code'
|
28
|
+
print 'Enter the authorization code here: '
|
29
|
+
code = STDIN.readline.strip
|
30
|
+
|
31
|
+
# This will fail if the user gave us an invalid authorization code
|
32
|
+
access_token, user_id = flow.finish(code)
|
33
|
+
|
34
|
+
puts "export DROPBOX_ACCESS_TOKEN=#{access_token}"
|
35
|
+
puts "export DROPBOX_USER_ID=#{user_id}"
|
27
36
|
puts
|
28
37
|
puts "This auth token will last for 10 years, or when you choose to invalidate it, whichever comes first."
|
29
38
|
puts
|
30
39
|
puts "Now either include these constants in yours calls to dbox, or set them as environment variables."
|
31
40
|
puts "In bash, including them in calls looks like:"
|
32
|
-
puts "$
|
41
|
+
puts "$ DROPBOX_ACCESS_TOKEN=#{access_token} DROPBOX_USER_ID=#{user_id} dbox ..."
|
33
42
|
end
|
34
43
|
|
35
44
|
def self.connect
|
@@ -50,21 +59,12 @@ module Dbox
|
|
50
59
|
end
|
51
60
|
|
52
61
|
def connect
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
access_type = ENV["DROPBOX_ACCESS_TYPE"] || "dropbox" # "app_folder"
|
58
|
-
|
59
|
-
raise(ConfigurationError, "Please set the DROPBOX_APP_KEY environment variable to a Dropbox application key") unless app_key
|
60
|
-
raise(ConfigurationError, "Please set the DROPBOX_APP_SECRET environment variable to a Dropbox application secret") unless app_secret
|
61
|
-
raise(ConfigurationError, "Please set the DROPBOX_AUTH_KEY environment variable to an authenticated Dropbox session key") unless auth_key
|
62
|
-
raise(ConfigurationError, "Please set the DROPBOX_AUTH_SECRET environment variable to an authenticated Dropbox session secret") unless auth_secret
|
62
|
+
access_token = ENV["DROPBOX_ACCESS_TOKEN"]
|
63
|
+
access_type = ENV["DROPBOX_ACCESS_TYPE"] || "dropbox"
|
64
|
+
|
65
|
+
raise(ConfigurationError, "Please set the DROPBOX_ACCESS_TOKEN environment variable to a Dropbox access token") unless access_token
|
63
66
|
raise(ConfigurationError, "Please set the DROPBOX_ACCESS_TYPE environment variable either dropbox (full access) or sandbox (App access)") unless access_type == "dropbox" || access_type == "app_folder"
|
64
|
-
|
65
|
-
@session = DropboxSession.new(app_key, app_secret)
|
66
|
-
@session.set_access_token(auth_key, auth_secret)
|
67
|
-
@client = DropboxClient.new(@session, access_type)
|
67
|
+
@client = DropboxClient.new(access_token)
|
68
68
|
end
|
69
69
|
|
70
70
|
def run(path, tries = NUM_TRIES, &proc)
|
metadata
CHANGED
@@ -1,96 +1,105 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbox
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
- 6
|
10
|
-
version: 0.7.6
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Ken Pratt
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: multipart-post
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 23
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 1
|
32
|
-
- 2
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 1.1.2
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: oauth
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.1.2
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: oauth
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
40
33
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 5
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
- 4
|
48
|
-
- 5
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
49
37
|
version: 0.4.5
|
50
38
|
type: :runtime
|
51
|
-
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: json
|
54
39
|
prerelease: false
|
55
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.4.5
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: json
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
56
49
|
none: false
|
57
|
-
requirements:
|
58
|
-
- -
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
hash: 5
|
61
|
-
segments:
|
62
|
-
- 1
|
63
|
-
- 5
|
64
|
-
- 3
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
65
53
|
version: 1.5.3
|
66
54
|
type: :runtime
|
67
|
-
|
68
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.5.3
|
62
|
+
- !ruby/object:Gem::Dependency
|
69
63
|
name: sqlite3
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.3.3
|
70
|
+
type: :runtime
|
70
71
|
prerelease: false
|
71
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
73
|
none: false
|
73
|
-
requirements:
|
74
|
-
- -
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
hash: 29
|
77
|
-
segments:
|
78
|
-
- 1
|
79
|
-
- 3
|
80
|
-
- 3
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
81
77
|
version: 1.3.3
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: dropbox-sdk
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.6.2
|
82
86
|
type: :runtime
|
83
|
-
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.6.2
|
84
94
|
description: An easy-to-use Dropbox client with fine-grained control over syncs.
|
85
95
|
email: ken@kenpratt.net
|
86
|
-
executables:
|
96
|
+
executables:
|
87
97
|
- dbox
|
88
98
|
extensions: []
|
89
|
-
|
90
|
-
extra_rdoc_files:
|
99
|
+
extra_rdoc_files:
|
91
100
|
- LICENSE.txt
|
92
101
|
- README.md
|
93
|
-
files:
|
102
|
+
files:
|
94
103
|
- .document
|
95
104
|
- History.txt
|
96
105
|
- LICENSE.txt
|
@@ -110,51 +119,30 @@ files:
|
|
110
119
|
- sample_polling_script.rb
|
111
120
|
- spec/dbox_spec.rb
|
112
121
|
- spec/spec_helper.rb
|
113
|
-
- vendor/dropbox-ruby-sdk/CHANGELOG
|
114
|
-
- vendor/dropbox-ruby-sdk/LICENSE
|
115
|
-
- vendor/dropbox-ruby-sdk/README
|
116
|
-
- vendor/dropbox-ruby-sdk/cli_example.rb
|
117
|
-
- vendor/dropbox-ruby-sdk/copy_between_accounts.rb
|
118
|
-
- vendor/dropbox-ruby-sdk/dropbox_controller.rb
|
119
|
-
- vendor/dropbox-ruby-sdk/gemspec.rb
|
120
|
-
- vendor/dropbox-ruby-sdk/lib/dropbox_sdk.rb
|
121
|
-
- vendor/dropbox-ruby-sdk/lib/trusted-certs.crt
|
122
|
-
- vendor/dropbox-ruby-sdk/search_cache.json
|
123
|
-
- vendor/dropbox-ruby-sdk/search_cache.rb
|
124
|
-
- vendor/dropbox-ruby-sdk/web_file_browser.rb
|
125
122
|
- vendor/insensitive_hash_patched.rb
|
126
123
|
homepage: http://github.com/kenpratt/dbox
|
127
|
-
licenses:
|
124
|
+
licenses:
|
128
125
|
- MIT
|
129
126
|
post_install_message:
|
130
127
|
rdoc_options: []
|
131
|
-
|
132
|
-
require_paths:
|
128
|
+
require_paths:
|
133
129
|
- lib
|
134
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
131
|
none: false
|
136
|
-
requirements:
|
137
|
-
- -
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
|
140
|
-
|
141
|
-
- 0
|
142
|
-
version: "0"
|
143
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
137
|
none: false
|
145
|
-
requirements:
|
146
|
-
- -
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
|
149
|
-
segments:
|
150
|
-
- 0
|
151
|
-
version: "0"
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
152
142
|
requirements: []
|
153
|
-
|
154
143
|
rubyforge_project:
|
155
|
-
rubygems_version: 1.8.
|
144
|
+
rubygems_version: 1.8.23
|
156
145
|
signing_key:
|
157
146
|
specification_version: 3
|
158
147
|
summary: Dropbox made easy.
|
159
148
|
test_files: []
|
160
|
-
|