dbox 0.7.6 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -1,42 +0,0 @@
|
|
1
|
-
1.3.1 (2012-5-16)
|
2
|
-
* Increase metadata() file list limit to 25,000 (used to be 10,000).
|
3
|
-
* Use CGI.escape() instead of the deprecated URI.escape().
|
4
|
-
|
5
|
-
1.3 (2012-3-26)
|
6
|
-
* Add support for the /delta API.
|
7
|
-
* Add support for the "copy ref" API.
|
8
|
-
|
9
|
-
1.2 (2012-1-11)
|
10
|
-
* Adds a method to the SDK that returns the file metadata when downloading a
|
11
|
-
file or its thumbnail.
|
12
|
-
* Validate server's SSL certificate against CAs in included certificate file.
|
13
|
-
|
14
|
-
1.1 (2011-10-17)
|
15
|
-
* Various bug fixes found during beta period
|
16
|
-
* Improved documentation
|
17
|
-
* Improved module structure
|
18
|
-
* Removed dependency on the oauth module, using plaintext authentication over https
|
19
|
-
|
20
|
-
1.0 (2011-8-16)
|
21
|
-
* Backwards compatibility broken
|
22
|
-
- Changed interface
|
23
|
-
- Change 'sandbox' references to 'app_folder'
|
24
|
-
* Updated SDK to Dropbox API Version 1, supporting all calls
|
25
|
-
- Added 'rev' parameter to metadata and get_file
|
26
|
-
- Added 'parent_rev' parameter to put_file
|
27
|
-
- Added search, share, media, revisions, and restore
|
28
|
-
- put_file uses /files_put instead of multipart POST
|
29
|
-
- Removed methods for calls that were removed from v1 of the REST API
|
30
|
-
* Changed return format for calls
|
31
|
-
- On error (non-200 response), an exception is raised
|
32
|
-
- On success, the JSON is parsed and a Hash is returned
|
33
|
-
* Updated examples
|
34
|
-
- Improved CLI example
|
35
|
-
- Added a Ruby on Rails 3 controller example
|
36
|
-
- Added a web based file browser/uploader that uses Sinatra
|
37
|
-
* put_file no longer takes a "name" arugment, only takes a full path
|
38
|
-
* Removed reliance on config files
|
39
|
-
* Assorted bugfixes and improvements
|
40
|
-
* All calls are now made over SSL
|
41
|
-
* Fully documented code for RDoc generation
|
42
|
-
* Added a CHANGELOG
|
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2009-2011 Dropbox Inc., http://www.dropbox.com/
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,7 +0,0 @@
|
|
1
|
-
Getting started with the Dropbox Ruby SDK:
|
2
|
-
1. Install json and oauth ruby gems with:
|
3
|
-
gem install json oauth
|
4
|
-
2. Edit cli_example.rb to to include your APP_KEY and APP_SECRET
|
5
|
-
3. Try running the example app: 'ruby cli_example.rb'.
|
6
|
-
4. See dropbox_controller.rb for an example Ruby on Rails controller. It needs an APP_KEY and APP_SECRET set too.
|
7
|
-
5. Check out the dropbox website for reference and help! http://dropbox.com/developers_beta
|
@@ -1,206 +0,0 @@
|
|
1
|
-
require './lib/dropbox_sdk'
|
2
|
-
require 'pp'
|
3
|
-
|
4
|
-
####
|
5
|
-
# An example app using the Dropbox API Ruby Client
|
6
|
-
# This ruby script sets up a basic command line interface (CLI)
|
7
|
-
# that prompts a user to authenticate on the web, then
|
8
|
-
# allows them to type commands to manipulate their dropbox.
|
9
|
-
####
|
10
|
-
|
11
|
-
# You must use your Dropbox App key and secret to use the API.
|
12
|
-
# Find this at https://www.dropbox.com/developers
|
13
|
-
APP_KEY = ''
|
14
|
-
APP_SECRET = ''
|
15
|
-
ACCESS_TYPE = :app_folder #The two valid values here are :app_folder and :dropbox
|
16
|
-
#The default is :app_folder, but your application might be
|
17
|
-
#set to have full :dropbox access. Check your app at
|
18
|
-
#https://www.dropbox.com/developers/apps
|
19
|
-
|
20
|
-
class DropboxCLI
|
21
|
-
LOGIN_REQUIRED = %w{put get cp mv rm ls mkdir info logout search thumbnail}
|
22
|
-
|
23
|
-
def initialize
|
24
|
-
if APP_KEY == '' or APP_SECRET == ''
|
25
|
-
puts "You must set your APP_KEY and APP_SECRET in cli_example.rb!"
|
26
|
-
puts "Find this in your apps page at https://www.dropbox.com/developers/"
|
27
|
-
exit
|
28
|
-
end
|
29
|
-
|
30
|
-
@session = DropboxSession.new(APP_KEY, APP_SECRET)
|
31
|
-
@client = nil
|
32
|
-
end
|
33
|
-
|
34
|
-
def login
|
35
|
-
########
|
36
|
-
# Instead of going to a authorize URL, you can set a access token key and secret
|
37
|
-
# from a previous session
|
38
|
-
########
|
39
|
-
# @session.set_access_token('key', 'secret')
|
40
|
-
|
41
|
-
if @session.authorized?
|
42
|
-
puts "already logged in!"
|
43
|
-
else
|
44
|
-
|
45
|
-
# grab the request token for session
|
46
|
-
@session.get_request_token
|
47
|
-
|
48
|
-
authorize_url = @session.get_authorize_url
|
49
|
-
puts "Got a request token. Your request token key is #{@session.request_token.key} and your token secret is #{@session.request_token.secret}"
|
50
|
-
|
51
|
-
# make the user log in and authorize this token
|
52
|
-
puts "AUTHORIZING", authorize_url, "Please visit that web page and hit 'Allow', then hit Enter here."
|
53
|
-
gets
|
54
|
-
|
55
|
-
# get the access token from the server. Its then stored in the session.
|
56
|
-
@session.get_access_token
|
57
|
-
|
58
|
-
end
|
59
|
-
puts "You are logged in. Your access token key is #{@session.access_token.key} your secret is #{@session.access_token.secret}"
|
60
|
-
@client = DropboxClient.new(@session, ACCESS_TYPE)
|
61
|
-
end
|
62
|
-
|
63
|
-
def command_loop
|
64
|
-
puts "Enter a command or 'help' or 'exit'"
|
65
|
-
command_line = ''
|
66
|
-
while command_line.strip != 'exit'
|
67
|
-
begin
|
68
|
-
execute_dropbox_command(command_line)
|
69
|
-
rescue RuntimeError => e
|
70
|
-
puts "Command Line Error! #{e.class}: #{e}"
|
71
|
-
puts e.backtrace
|
72
|
-
end
|
73
|
-
print '> '
|
74
|
-
command_line = gets.strip
|
75
|
-
end
|
76
|
-
puts 'goodbye'
|
77
|
-
exit(0)
|
78
|
-
end
|
79
|
-
|
80
|
-
def execute_dropbox_command(cmd_line)
|
81
|
-
command = cmd_line.split
|
82
|
-
method = command.first
|
83
|
-
if LOGIN_REQUIRED.include? method
|
84
|
-
if @client
|
85
|
-
send(method.to_sym, command)
|
86
|
-
else
|
87
|
-
puts 'must be logged in; type \'login\' to get started.'
|
88
|
-
end
|
89
|
-
elsif ['login', 'help'].include? method
|
90
|
-
send(method.to_sym)
|
91
|
-
else
|
92
|
-
if command.first && !command.first.strip.empty?
|
93
|
-
puts 'invalid command. type \'help\' to see commands.'
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def logout(command)
|
99
|
-
@session.clear_access_token
|
100
|
-
puts "You are logged out."
|
101
|
-
@client = nil
|
102
|
-
end
|
103
|
-
|
104
|
-
def put(command)
|
105
|
-
fname = command[1]
|
106
|
-
|
107
|
-
#If the user didn't specifiy the file name, just use the name of the file on disk
|
108
|
-
if command[2]
|
109
|
-
new_name = command[2]
|
110
|
-
else
|
111
|
-
new_name = File.basename(fname)
|
112
|
-
end
|
113
|
-
|
114
|
-
if fname && !fname.empty? && File.exists?(fname) && (File.ftype(fname) == 'file') && File.stat(fname).readable?
|
115
|
-
#This is where we call the the Dropbox Client
|
116
|
-
pp @client.put_file(new_name, open(fname))
|
117
|
-
else
|
118
|
-
puts "couldn't find the file #{ fname }"
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
def get(command)
|
123
|
-
dest = command[2]
|
124
|
-
if !command[1] || command[1].empty?
|
125
|
-
puts "please specify item to get"
|
126
|
-
elsif !dest || dest.empty?
|
127
|
-
puts "please specify full local path to dest, i.e. the file to write to"
|
128
|
-
elsif File.exists?(dest)
|
129
|
-
puts "error: File #{dest} already exists."
|
130
|
-
else
|
131
|
-
src = clean_up(command[1])
|
132
|
-
out,metadata = @client.get_file_and_metadata('/' + src)
|
133
|
-
puts "Metadata:"
|
134
|
-
pp metadata
|
135
|
-
open(dest, 'w'){|f| f.puts out }
|
136
|
-
puts "wrote file #{dest}."
|
137
|
-
end
|
138
|
-
end
|
139
|
-
|
140
|
-
def mkdir(command)
|
141
|
-
pp @client.file_create_folder(command[1])
|
142
|
-
end
|
143
|
-
|
144
|
-
# Example:
|
145
|
-
# > thumbnail pic1.jpg ~/pic1-local.jpg large
|
146
|
-
def thumbnail(command)
|
147
|
-
dest = command[2]
|
148
|
-
command[3] ||= 'small'
|
149
|
-
out,metadata = @client.thumbnail_and_metadata(command[1], command[3])
|
150
|
-
puts "Metadata:"
|
151
|
-
pp metadata
|
152
|
-
open(dest, 'w'){|f| f.puts out }
|
153
|
-
puts "wrote thumbnail#{dest}."
|
154
|
-
end
|
155
|
-
|
156
|
-
def cp(command)
|
157
|
-
src = clean_up(command[1])
|
158
|
-
dest = clean_up(command[2])
|
159
|
-
pp @client.file_copy(src, dest)
|
160
|
-
end
|
161
|
-
|
162
|
-
def mv(command)
|
163
|
-
src = clean_up(command[1])
|
164
|
-
dest = clean_up(command[2])
|
165
|
-
pp @client.file_move(src, dest)
|
166
|
-
end
|
167
|
-
|
168
|
-
def rm(command)
|
169
|
-
pp @client.file_delete(clean_up(command[1]))
|
170
|
-
end
|
171
|
-
|
172
|
-
def search(command)
|
173
|
-
resp = @client.search('/',clean_up(command[1]))
|
174
|
-
|
175
|
-
for item in resp
|
176
|
-
puts item['path']
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
def info(command)
|
181
|
-
pp @client.account_info
|
182
|
-
end
|
183
|
-
|
184
|
-
def ls(command)
|
185
|
-
command[1] = '/' + clean_up(command[1] || '')
|
186
|
-
resp = @client.metadata(command[1])
|
187
|
-
|
188
|
-
if resp['contents'].length > 0
|
189
|
-
for item in resp['contents']
|
190
|
-
puts item['path']
|
191
|
-
end
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
def help
|
196
|
-
puts "commands are: login #{LOGIN_REQUIRED.join(' ')} help exit"
|
197
|
-
end
|
198
|
-
|
199
|
-
def clean_up(str)
|
200
|
-
return str.gsub(/^\/+/, '') if str
|
201
|
-
str
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
cli = DropboxCLI.new
|
206
|
-
cli.command_loop
|
@@ -1,155 +0,0 @@
|
|
1
|
-
require './lib/dropbox_sdk'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
# You must use your Dropbox App key and secret to use the API.
|
5
|
-
# Find this at https://www.dropbox.com/developers
|
6
|
-
APP_KEY = ''
|
7
|
-
APP_SECRET = ''
|
8
|
-
ACCESS_TYPE = :app_folder #The two valid values here are :app_folder and :dropbox
|
9
|
-
#The default is :app_folder, but your application might be
|
10
|
-
#set to have full :dropbox access. Check your app at
|
11
|
-
#https://www.dropbox.com/developers/apps
|
12
|
-
|
13
|
-
STATE_FILE = 'copy_between_accounts.json'
|
14
|
-
|
15
|
-
def main()
|
16
|
-
prog_name = __FILE__
|
17
|
-
if APP_KEY == '' or APP_SECRET == ''
|
18
|
-
warn "ERROR: Set your APP_KEY and APP_SECRET at the top of #{prog_name}"
|
19
|
-
exit
|
20
|
-
end
|
21
|
-
args = ARGV
|
22
|
-
if args.size == 0
|
23
|
-
warn("Usage:\n")
|
24
|
-
warn(" #{prog_name} link Link to a user's account. Also displays UID.")
|
25
|
-
warn(" #{prog_name} list List linked users including UID.")
|
26
|
-
warn(" #{prog_name} copy '<uid>:<path>' '<uid>:<path>' Copies a file from the first user's path, to the second user's path.")
|
27
|
-
warn("\n\n <uid> is the account UID shown when linked. <path> is a path to a file on that user's dropbox.")
|
28
|
-
exit
|
29
|
-
end
|
30
|
-
|
31
|
-
command = args[0]
|
32
|
-
if command == 'link'
|
33
|
-
command_link(args)
|
34
|
-
elsif command == 'list'
|
35
|
-
command_list(args)
|
36
|
-
elsif command == 'copy'
|
37
|
-
command_copy(args)
|
38
|
-
else
|
39
|
-
warn "ERROR: Unknown command: #{command}"
|
40
|
-
warn "Run with no arguments for help."
|
41
|
-
exit(1)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def command_link(args)
|
46
|
-
if args.size != 1
|
47
|
-
warn "ERROR: \"link\" doesn't take any arguments"
|
48
|
-
exit
|
49
|
-
end
|
50
|
-
|
51
|
-
sess = DropboxSession.new(APP_KEY, APP_SECRET)
|
52
|
-
sess.get_request_token
|
53
|
-
|
54
|
-
# Make the user log in and authorize this token
|
55
|
-
url = sess.get_authorize_url
|
56
|
-
puts "1. Go to: #{url}"
|
57
|
-
puts "2. Authorize this app."
|
58
|
-
puts "After you're done, press ENTER."
|
59
|
-
STDIN.gets
|
60
|
-
|
61
|
-
# This will fail if the user didn't visit the above URL and hit 'Allow'
|
62
|
-
sess.get_access_token
|
63
|
-
access_token = sess.access_token
|
64
|
-
c = DropboxClient.new(sess, ACCESS_TYPE)
|
65
|
-
account_info = c.account_info()
|
66
|
-
|
67
|
-
puts "Link successful. #{account_info['display_name']} is uid #{account_info['uid']} "
|
68
|
-
|
69
|
-
state = load_state()
|
70
|
-
state[account_info['uid']] = {
|
71
|
-
'access_token' => [access_token.key, access_token.secret],
|
72
|
-
'display_name' => account_info['display_name'],
|
73
|
-
}
|
74
|
-
|
75
|
-
save_state(state)
|
76
|
-
end
|
77
|
-
|
78
|
-
def command_list(args)
|
79
|
-
if args.size != 1
|
80
|
-
warn "ERROR: \"list\" doesn't take any arguments"
|
81
|
-
exit
|
82
|
-
end
|
83
|
-
|
84
|
-
state = load_state()
|
85
|
-
for e in state.keys()
|
86
|
-
puts "#{state[e]['display_name']} is uid #{e}"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def command_copy(args)
|
91
|
-
if args.size != 3
|
92
|
-
warn "ERROR: \"copy\" takes exactly two arguments"
|
93
|
-
exit
|
94
|
-
end
|
95
|
-
|
96
|
-
state = load_state()
|
97
|
-
|
98
|
-
if state.keys().length < 2
|
99
|
-
warn "ERROR: You can't use the copy command until at least two users have linked"
|
100
|
-
exit
|
101
|
-
end
|
102
|
-
|
103
|
-
from = args[1].gsub(/['"]/,'')
|
104
|
-
to = args[2].gsub(/['"]/,'')
|
105
|
-
|
106
|
-
if not to.index(':') or not from.index(':')
|
107
|
-
warn "ERROR: Ill-formated paths. Run #{prog_name} without arugments to see documentation."
|
108
|
-
exit
|
109
|
-
end
|
110
|
-
|
111
|
-
from_uid, from_path = from.split ":"
|
112
|
-
to_uid, to_path = to.split ":"
|
113
|
-
|
114
|
-
if not state.has_key?(to_uid) or not state.has_key?(from_uid)
|
115
|
-
warn "ERROR: Those UIDs have not linked. Run #{prog_name} list to see linked UIDs."
|
116
|
-
exit
|
117
|
-
end
|
118
|
-
|
119
|
-
from_token = state[from_uid]['access_token']
|
120
|
-
to_token = state[to_uid]['access_token']
|
121
|
-
|
122
|
-
from_session = DropboxSession.new(APP_KEY, APP_SECRET)
|
123
|
-
to_session = DropboxSession.new(APP_KEY, APP_SECRET)
|
124
|
-
|
125
|
-
from_session.set_access_token(*from_token)
|
126
|
-
to_session.set_access_token(*to_token)
|
127
|
-
|
128
|
-
from_client = DropboxClient.new(from_session, ACCESS_TYPE)
|
129
|
-
to_client = DropboxClient.new(to_session, ACCESS_TYPE)
|
130
|
-
|
131
|
-
#Create a copy ref under the identity of the from user
|
132
|
-
copy_ref = from_client.create_copy_ref(from_path)['copy_ref']
|
133
|
-
|
134
|
-
metadata = to_client.add_copy_ref(to_path, copy_ref)
|
135
|
-
|
136
|
-
puts "File successly copied from #{state[from_uid]['display_name']} to #{state[to_uid]['display_name']}!"
|
137
|
-
puts "The file now exists at #{metadata['path']}"
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
def save_state(state)
|
142
|
-
File.open(STATE_FILE,"w") do |f|
|
143
|
-
f.write(JSON.pretty_generate(state))
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
def load_state()
|
148
|
-
if not FileTest.exists?(STATE_FILE)
|
149
|
-
return {}
|
150
|
-
end
|
151
|
-
JSON.parse(File.read(STATE_FILE))
|
152
|
-
end
|
153
|
-
|
154
|
-
|
155
|
-
main()
|
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'dropbox_sdk'
|
2
|
-
|
3
|
-
# This is an example of a Rails 3 controller that authorizes an application
|
4
|
-
# and then uploads a file to the user's Dropbox.
|
5
|
-
|
6
|
-
# You must set these
|
7
|
-
APP_KEY = ""
|
8
|
-
APP_SECRET = ""
|
9
|
-
ACCESS_TYPE = :app_folder #The two valid values here are :app_folder and :dropbox
|
10
|
-
#The default is :app_folder, but your application might be
|
11
|
-
#set to have full :dropbox access. Check your app at
|
12
|
-
#https://www.dropbox.com/developers/apps
|
13
|
-
|
14
|
-
|
15
|
-
# Examples routes for config/routes.rb (Rails 3)
|
16
|
-
#match 'db/authorize', :controller => 'db', :action => 'authorize'
|
17
|
-
#match 'db/upload', :controller => 'db', :action => 'upload'
|
18
|
-
|
19
|
-
class DbController < ApplicationController
|
20
|
-
def authorize
|
21
|
-
if not params[:oauth_token] then
|
22
|
-
dbsession = DropboxSession.new(APP_KEY, APP_SECRET)
|
23
|
-
|
24
|
-
session[:dropbox_session] = dbsession.serialize #serialize and save this DropboxSession
|
25
|
-
|
26
|
-
#pass to get_authorize_url a callback url that will return the user here
|
27
|
-
redirect_to dbsession.get_authorize_url url_for(:action => 'authorize')
|
28
|
-
else
|
29
|
-
# the user has returned from Dropbox
|
30
|
-
dbsession = DropboxSession.deserialize(session[:dropbox_session])
|
31
|
-
dbsession.get_access_token #we've been authorized, so now request an access_token
|
32
|
-
session[:dropbox_session] = dbsession.serialize
|
33
|
-
|
34
|
-
redirect_to :action => 'upload'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def upload
|
39
|
-
# Check if user has no dropbox session...re-direct them to authorize
|
40
|
-
return redirect_to(:action => 'authorize') unless session[:dropbox_session]
|
41
|
-
|
42
|
-
dbsession = DropboxSession.deserialize(session[:dropbox_session])
|
43
|
-
client = DropboxClient.new(dbsession, ACCESS_TYPE) #raise an exception if session not authorized
|
44
|
-
info = client.account_info # look up account information
|
45
|
-
|
46
|
-
if request.method != "POST"
|
47
|
-
# show a file upload page
|
48
|
-
render :inline =>
|
49
|
-
"#{info['email']} <br/><%= form_tag({:action => :upload}, :multipart => true) do %><%= file_field_tag 'file' %><%= submit_tag %><% end %>"
|
50
|
-
return
|
51
|
-
else
|
52
|
-
# upload the posted file to dropbox keeping the same name
|
53
|
-
resp = client.put_file(params[:file].original_filename, params[:file].read)
|
54
|
-
render :text => "Upload successful! File now at #{resp['path']}"
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|