dropbox 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/{spec/spec.opts → .rspec} +0 -0
- data/ChangeLog +8 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +40 -0
- data/Rakefile +22 -36
- data/VERSION +1 -1
- data/dropbox.gemspec +5 -6
- data/lib/dropbox/api.rb +30 -22
- data/lib/dropbox/session.rb +8 -6
- data/spec/dropbox/api_spec.rb +32 -8
- data/spec/spec_helper.rb +6 -6
- metadata +19 -31
data/.gitignore
CHANGED
data/{spec/spec.opts → .rspec}
RENAMED
File without changes
|
data/ChangeLog
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
1.2 (2010-10-31)
|
2
|
+
|
3
|
+
* Updated thumbnail method for changes in the thumbnail API.
|
4
|
+
* Added the ability to upload files from +StringIO+ objects.
|
5
|
+
* Added option to customize uploaded file's remote name.
|
6
|
+
* Added proxy support for additional actions.
|
7
|
+
* Modernized gem: RSpec 2.0 compatible, now uses Bundler, etc.
|
8
|
+
|
1
9
|
1.1.2 (2010-10-6)
|
2
10
|
|
3
11
|
* Added ability to perform OAuth authorization on behalf of the user.
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
diff-lcs (1.1.2)
|
5
|
+
gemcutter (0.6.1)
|
6
|
+
git (1.2.5)
|
7
|
+
jeweler (1.4.0)
|
8
|
+
gemcutter (>= 0.1.0)
|
9
|
+
git (>= 1.2.5)
|
10
|
+
rubyforge (>= 2.0.0)
|
11
|
+
json (1.4.6)
|
12
|
+
json_pure (1.4.6)
|
13
|
+
mechanize (1.0.0)
|
14
|
+
nokogiri (>= 1.2.1)
|
15
|
+
multipart-post (1.0.1)
|
16
|
+
nokogiri (1.4.3.1)
|
17
|
+
oauth (0.4.3)
|
18
|
+
rspec (2.0.1)
|
19
|
+
rspec-core (~> 2.0.1)
|
20
|
+
rspec-expectations (~> 2.0.1)
|
21
|
+
rspec-mocks (~> 2.0.1)
|
22
|
+
rspec-core (2.0.1)
|
23
|
+
rspec-expectations (2.0.1)
|
24
|
+
diff-lcs (>= 1.1.2)
|
25
|
+
rspec-mocks (2.0.1)
|
26
|
+
rspec-core (~> 2.0.1)
|
27
|
+
rspec-expectations (~> 2.0.1)
|
28
|
+
rubyforge (2.0.4)
|
29
|
+
json_pure (>= 1.1.7)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
ruby
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
jeweler
|
36
|
+
json (>= 1.2.0)
|
37
|
+
mechanize (>= 1.0.0)
|
38
|
+
multipart-post (>= 1.0)
|
39
|
+
oauth (>= 0.3.6)
|
40
|
+
rspec (>= 2.0)
|
data/Rakefile
CHANGED
@@ -1,48 +1,32 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'rake'
|
3
|
-
|
4
2
|
begin
|
5
|
-
require '
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "dropbox"
|
8
|
-
gem.version = File.read("VERSION").chomp.strip
|
9
|
-
gem.summary = %Q{Ruby client library for the official Dropbox API}
|
10
|
-
gem.description = %Q{An easy-to-use client library for the official Dropbox API.}
|
11
|
-
gem.email = "dropbox@timothymorgan.info"
|
12
|
-
gem.homepage = "http://github.com/RISCfuture/dropbox"
|
13
|
-
gem.authors = ["Tim Morgan"]
|
14
|
-
|
15
|
-
gem.files += FileList["lib/dropbox/*.rb"]
|
16
|
-
gem.add_development_dependency "rspec", ">= 1.2.9"
|
17
|
-
gem.add_runtime_dependency "oauth", ">= 0.3.6"
|
18
|
-
gem.add_runtime_dependency "json", ">= 1.2.0"
|
19
|
-
gem.add_runtime_dependency "multipart-post", ">= 1.0"
|
20
|
-
gem.add_runtime_dependency "mechanize", ">= 1.0.0"
|
21
|
-
end
|
22
|
-
Jeweler::GemcutterTasks.new
|
23
|
-
Jeweler::RubyforgeTasks.new
|
3
|
+
require 'bundler'
|
24
4
|
rescue LoadError
|
25
|
-
puts "
|
26
|
-
|
27
|
-
|
28
|
-
require 'spec/rake/spectask'
|
29
|
-
Spec::Rake::SpecTask.new(:spec) do |spec|
|
30
|
-
spec.libs << 'lib' << 'spec'
|
31
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
5
|
+
puts "Bundler is not installed; install with `gem install bundler`."
|
6
|
+
exit 1
|
32
7
|
end
|
33
8
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
9
|
+
Bundler.require :default
|
10
|
+
|
11
|
+
Jeweler::Tasks.new do |gem|
|
12
|
+
gem.name = "dropbox"
|
13
|
+
gem.summary = %Q{Ruby client library for the official Dropbox API}
|
14
|
+
gem.description = %Q{An easy-to-use client library for the official Dropbox API.}
|
15
|
+
gem.email = "dropbox@timothymorgan.info"
|
16
|
+
gem.homepage = "http://github.com/RISCfuture/dropbox"
|
17
|
+
gem.authors = [ "Tim Morgan" ]
|
18
|
+
gem.add_dependency 'oauth', '>= 0.3.6'
|
19
|
+
gem.add_dependency 'json', '>= 1.2.0'
|
20
|
+
gem.add_dependency 'multipart-post', '>= 1.0'
|
21
|
+
gem.add_dependency 'mechanize', '>= 1.0.0'
|
38
22
|
end
|
23
|
+
Jeweler::GemcutterTasks.new
|
39
24
|
|
40
|
-
|
41
|
-
|
42
|
-
task :default => :spec
|
25
|
+
require 'rspec/core/rake_task'
|
26
|
+
RSpec::Core::RakeTask.new
|
43
27
|
|
44
28
|
require 'rake/rdoctask'
|
45
|
-
Rake::RDocTask.new do |rdoc|
|
29
|
+
Rake::RDocTask.new(:doc) do |rdoc|
|
46
30
|
version = File.exist?('VERSION') ? File.read('VERSION').chomp.strip : ""
|
47
31
|
|
48
32
|
rdoc.rdoc_dir = 'rdoc'
|
@@ -51,3 +35,5 @@ Rake::RDocTask.new do |rdoc|
|
|
51
35
|
rdoc.rdoc_files.include('LICENSE')
|
52
36
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
37
|
end
|
38
|
+
|
39
|
+
task(default: :spec)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
data/dropbox.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dropbox}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tim Morgan"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-31}
|
13
13
|
s.description = %q{An easy-to-use client library for the official Dropbox API.}
|
14
14
|
s.email = %q{dropbox@timothymorgan.info}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -20,7 +20,10 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
22
|
".gitignore",
|
23
|
+
".rspec",
|
23
24
|
"ChangeLog",
|
25
|
+
"Gemfile",
|
26
|
+
"Gemfile.lock",
|
24
27
|
"LICENSE",
|
25
28
|
"README.rdoc",
|
26
29
|
"Rakefile",
|
@@ -46,7 +49,6 @@ Gem::Specification.new do |s|
|
|
46
49
|
"spec/dropbox/revision_spec.rb",
|
47
50
|
"spec/dropbox/session_spec.rb",
|
48
51
|
"spec/dropbox_spec.rb",
|
49
|
-
"spec/spec.opts",
|
50
52
|
"spec/spec_helper.rb"
|
51
53
|
]
|
52
54
|
s.homepage = %q{http://github.com/RISCfuture/dropbox}
|
@@ -69,20 +71,17 @@ Gem::Specification.new do |s|
|
|
69
71
|
s.specification_version = 3
|
70
72
|
|
71
73
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
72
|
-
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
73
74
|
s.add_runtime_dependency(%q<oauth>, [">= 0.3.6"])
|
74
75
|
s.add_runtime_dependency(%q<json>, [">= 1.2.0"])
|
75
76
|
s.add_runtime_dependency(%q<multipart-post>, [">= 1.0"])
|
76
77
|
s.add_runtime_dependency(%q<mechanize>, [">= 1.0.0"])
|
77
78
|
else
|
78
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
79
79
|
s.add_dependency(%q<oauth>, [">= 0.3.6"])
|
80
80
|
s.add_dependency(%q<json>, [">= 1.2.0"])
|
81
81
|
s.add_dependency(%q<multipart-post>, [">= 1.0"])
|
82
82
|
s.add_dependency(%q<mechanize>, [">= 1.0.0"])
|
83
83
|
end
|
84
84
|
else
|
85
|
-
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
86
85
|
s.add_dependency(%q<oauth>, [">= 0.3.6"])
|
87
86
|
s.add_dependency(%q<json>, [">= 1.2.0"])
|
88
87
|
s.add_dependency(%q<multipart-post>, [">= 1.0"])
|
data/lib/dropbox/api.rb
CHANGED
@@ -88,7 +88,7 @@ module Dropbox
|
|
88
88
|
api_body :get, 'files', root(options), *rest
|
89
89
|
#TODO streaming, range queries
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
# Downloads a minimized thumbnail for a file. Pass the path to the file,
|
93
93
|
# optionally the size of the thumbnail you want, and any additional options.
|
94
94
|
# See https://www.dropbox.com/developers/docs#thumbnails for a list of valid
|
@@ -105,6 +105,8 @@ module Dropbox
|
|
105
105
|
#
|
106
106
|
# Options:
|
107
107
|
#
|
108
|
+
# +format+:: The image format (see the API documentation for supported
|
109
|
+
# formats).
|
108
110
|
# +mode+:: Temporarily changes the API mode. See the MODES array.
|
109
111
|
#
|
110
112
|
# Examples:
|
@@ -116,18 +118,13 @@ module Dropbox
|
|
116
118
|
# Get the thumbnail for an image in the +medium+ size:
|
117
119
|
#
|
118
120
|
# session.thumbnail('my/image.jpg', 'medium')
|
119
|
-
|
120
|
-
def thumbnail(
|
121
|
-
options = args.extract_options!
|
122
|
-
path = args.shift
|
123
|
-
size = args.shift
|
124
|
-
raise ArgumentError, "thumbnail takes a path, an optional size, and optional options" unless path.kind_of?(String) and (size.kind_of?(String) or size.nil?) and args.empty?
|
125
|
-
|
121
|
+
|
122
|
+
def thumbnail(path, options={})\
|
126
123
|
path = path.sub(/^\//, '')
|
127
124
|
rest = Dropbox.check_path(path).split('/')
|
128
125
|
rest << { :ssl => @ssl }
|
129
|
-
rest.last
|
130
|
-
|
126
|
+
rest.last.merge! options
|
127
|
+
|
131
128
|
begin
|
132
129
|
api_body :get, 'thumbnails', root(options), *rest
|
133
130
|
rescue Dropbox::UnsuccessfulResponseError => e
|
@@ -141,18 +138,22 @@ module Dropbox
|
|
141
138
|
# of the remote file will be identical to that of the local file. You can
|
142
139
|
# provide any of the following for the first parameter:
|
143
140
|
#
|
144
|
-
# * a +File+ object
|
145
|
-
# * a path to a file
|
141
|
+
# * a +File+ object (in which case the name of the local file is used),
|
142
|
+
# * a path to a file (in which case that file's name is used), or
|
143
|
+
# * a +StringIO+ (in which case the <tt>:as</tt> option must be specified.
|
146
144
|
#
|
147
145
|
# Options:
|
148
146
|
#
|
149
147
|
# +mode+:: Temporarily changes the API mode. See the MODES array.
|
148
|
+
# +as+:: Specify a custom name for the uploaded file (required when
|
149
|
+
# uploading from a +StringIO+ stream).
|
150
150
|
#
|
151
151
|
# Examples:
|
152
152
|
#
|
153
153
|
# session.upload 'music.pdf', '/' # upload a file by path to the root directory
|
154
154
|
# session.upload 'music.pdf, 'music/' # upload a file by path to the music folder
|
155
155
|
# session.upload File.new('music.pdf'), '/' # same as the first example
|
156
|
+
# session.upload open('http://www.example.com/index.html'), :as => 'example.html' # upload from a StringIO stream (requires open-uri)
|
156
157
|
|
157
158
|
def upload(local_file, remote_path, options={})
|
158
159
|
if local_file.kind_of?(File) or local_file.kind_of?(Tempfile) then
|
@@ -163,9 +164,15 @@ module Dropbox
|
|
163
164
|
file = File.new(local_file)
|
164
165
|
name = File.basename(local_file)
|
165
166
|
local_path = local_file
|
167
|
+
elsif local_file.kind_of?(StringIO) then
|
168
|
+
raise(ArgumentError, "Must specify the :as option when uploading from StringIO") unless options[:as]
|
169
|
+
file = local_file
|
170
|
+
local_path = options[:as]
|
166
171
|
else
|
167
|
-
raise ArgumentError, "local_file must be a File or file path"
|
172
|
+
raise ArgumentError, "local_file must be a File, StringIO, or file path"
|
168
173
|
end
|
174
|
+
|
175
|
+
name = options.delete(:as).to_s if options[:as]
|
169
176
|
|
170
177
|
remote_path = remote_path.sub(/^\//, '')
|
171
178
|
remote_path = Dropbox.check_path(remote_path).split('/')
|
@@ -188,8 +195,9 @@ module Dropbox
|
|
188
195
|
name,
|
189
196
|
local_path))
|
190
197
|
request['authorization'] = oauth_signature.join(', ')
|
191
|
-
|
192
|
-
|
198
|
+
|
199
|
+
proxy = URI.parse(@proxy || "")
|
200
|
+
response = Net::HTTP::Proxy(proxy.host, proxy.port).new(uri.host, uri.port).request(request)
|
193
201
|
if response.kind_of?(Net::HTTPSuccess) then
|
194
202
|
begin
|
195
203
|
return JSON.parse(response.body).symbolize_keys_recursively.to_struct_recursively
|
@@ -264,7 +272,7 @@ module Dropbox
|
|
264
272
|
# +mode+:: Temporarily changes the API mode. See the MODES array.
|
265
273
|
#
|
266
274
|
# TODO The API documentation says this method returns 404 if the path does not exist, but it actually returns 5xx.
|
267
|
-
|
275
|
+
|
268
276
|
def delete(path, options={})
|
269
277
|
path = path.sub(/^\//, '')
|
270
278
|
path.sub! /\/$/, ''
|
@@ -388,7 +396,7 @@ module Dropbox
|
|
388
396
|
#args.last[:hash] = options[:hash] if options[:hash]
|
389
397
|
args.last[:list] = !(options[:suppress_list].to_bool)
|
390
398
|
args.last[:ssl] = @ssl
|
391
|
-
|
399
|
+
|
392
400
|
begin
|
393
401
|
parse_metadata(get(*args)).to_struct_recursively
|
394
402
|
rescue UnsuccessfulResponseError => error
|
@@ -419,7 +427,7 @@ module Dropbox
|
|
419
427
|
metadata(path, options.merge(:suppress_list => false)).contents
|
420
428
|
end
|
421
429
|
alias :ls :list
|
422
|
-
|
430
|
+
|
423
431
|
def event_metadata(target_events, options={}) # :nodoc:
|
424
432
|
get 'event_metadata', :ssl => @ssl, :root => root(options), :target_events => target_events
|
425
433
|
end
|
@@ -558,17 +566,17 @@ module Dropbox
|
|
558
566
|
# limit.
|
559
567
|
|
560
568
|
class TooManyEntriesError < FileError; end
|
561
|
-
|
569
|
+
|
562
570
|
# Raised when the event_metadata method returns an error.
|
563
|
-
|
571
|
+
|
564
572
|
class PingbackError < StandardError
|
565
573
|
# The HTTP error code returned by the event_metadata method.
|
566
574
|
attr_reader :code
|
567
|
-
|
575
|
+
|
568
576
|
def initialize(code) # :nodoc
|
569
577
|
@code = code
|
570
578
|
end
|
571
|
-
|
579
|
+
|
572
580
|
def to_s # :nodoc:
|
573
581
|
"#{self.class.to_s} code #{@code}"
|
574
582
|
end
|
data/lib/dropbox/session.rb
CHANGED
@@ -131,7 +131,7 @@ module Dropbox
|
|
131
131
|
|
132
132
|
login_form.login_email = @authorizing_user
|
133
133
|
login_form.login_password = @authorizing_password
|
134
|
-
auth_page = login_form.submit
|
134
|
+
auth_page = login_form.submit
|
135
135
|
|
136
136
|
auth_form = auth_page.form_with(:action => 'authorize')
|
137
137
|
if auth_form
|
@@ -145,6 +145,12 @@ module Dropbox
|
|
145
145
|
authorize
|
146
146
|
end
|
147
147
|
|
148
|
+
# Returns the OAuth access_token which allows access to token and secret.
|
149
|
+
|
150
|
+
def access_token
|
151
|
+
@access_token || raise(UnauthorizedError, "You need to authorize the Dropbox user before you can call API methods")
|
152
|
+
end
|
153
|
+
|
148
154
|
# Serializes this object into a string that can then be recreated with the
|
149
155
|
# Dropbox::Session.deserialize method.
|
150
156
|
|
@@ -179,13 +185,9 @@ module Dropbox
|
|
179
185
|
|
180
186
|
private
|
181
187
|
|
182
|
-
def access_token
|
183
|
-
@access_token || raise(UnauthorizedError, "You need to authorize the Dropbox user before you can call API methods")
|
184
|
-
end
|
185
|
-
|
186
188
|
def clone_with_host(host)
|
187
189
|
session = dup
|
188
|
-
consumer = OAuth::Consumer.new(@consumer.key, @consumer.secret, :site => host)
|
190
|
+
consumer = OAuth::Consumer.new(@consumer.key, @consumer.secret, :site => host, :proxy => @proxy)
|
189
191
|
session.instance_variable_set :@consumer, consumer
|
190
192
|
session.instance_variable_set :@access_token, OAuth::AccessToken.new(consumer, @access_token.token, @access_token.secret)
|
191
193
|
return session
|
data/spec/dropbox/api_spec.rb
CHANGED
@@ -30,7 +30,8 @@ def stub_for_upload_testing
|
|
30
30
|
@response.stub!(:kind_of?).with(Net::HTTPSuccess).and_return(true)
|
31
31
|
@response.stub!(:body).and_return('{"test":"val"}')
|
32
32
|
|
33
|
-
Net::HTTP
|
33
|
+
@http = mock('Net::HTTP', :request => @response)
|
34
|
+
Net::HTTP.stub!(:new).and_return(@http)
|
34
35
|
end
|
35
36
|
|
36
37
|
def response_acts_as(subclass)
|
@@ -121,11 +122,6 @@ describe Dropbox::API do
|
|
121
122
|
@session.thumbnail(path)
|
122
123
|
end
|
123
124
|
|
124
|
-
it "should pass along a size" do
|
125
|
-
should_receive_api_method_with_arguments @token_mock, :get, 'thumbnails', { :size => 'medium' }, @response, 'path/to/file', 'sandbox'
|
126
|
-
@session.thumbnail "path/to/file", 'medium'
|
127
|
-
end
|
128
|
-
|
129
125
|
it "should raise an error if too many arguments are given" do
|
130
126
|
lambda { @session.thumbnail "path/to/file", 'large', 'oops', :foo => 'bar' }.should raise_error(ArgumentError)
|
131
127
|
end
|
@@ -553,6 +549,11 @@ describe Dropbox::API do
|
|
553
549
|
UploadIO.should_receive(:convert!).once.with(@file, anything, File.basename(__FILE__), __FILE__)
|
554
550
|
@session.upload @file, 'remote/'
|
555
551
|
end
|
552
|
+
|
553
|
+
it "should accept a custom file name via the :as parameter" do
|
554
|
+
UploadIO.should_receive(:convert!).once.with(@file, anything, 'myfile.txt', __FILE__)
|
555
|
+
@session.upload @file, 'remote/', :as => 'myfile.txt'
|
556
|
+
end
|
556
557
|
end
|
557
558
|
|
558
559
|
describe "given a String object" do
|
@@ -566,11 +567,32 @@ describe Dropbox::API do
|
|
566
567
|
UploadIO.should_receive(:convert!).once.with(@file, anything, File.basename(__FILE__), __FILE__)
|
567
568
|
@session.upload @string, 'remote/'
|
568
569
|
end
|
570
|
+
|
571
|
+
it "should accept a custom file name via the :as parameter" do
|
572
|
+
UploadIO.should_receive(:convert!).once.with(@file, anything, 'myfile.txt', __FILE__)
|
573
|
+
@session.upload @string, 'remote/', :as => 'myfile.txt'
|
574
|
+
end
|
569
575
|
end
|
570
576
|
|
571
577
|
it "should raise an error if given an unknown argument type" do
|
572
578
|
lambda { @session.upload 123, 'path' }.should raise_error(ArgumentError)
|
573
579
|
end
|
580
|
+
|
581
|
+
describe "given a StringIO object and a filename" do
|
582
|
+
before :each do
|
583
|
+
@string_io = StringIO.new("test123")
|
584
|
+
@filename = "test.txt"
|
585
|
+
end
|
586
|
+
|
587
|
+
it "should use the StringIO as the stream and take filename from the options" do
|
588
|
+
UploadIO.should_receive(:convert!).once.with(@string_io, anything, @filename, @filename)
|
589
|
+
@session.upload @string_io, 'remote/', :as => @filename
|
590
|
+
end
|
591
|
+
|
592
|
+
it "should raise an exception if the :as option is not specified" do
|
593
|
+
lambda { @session.upload @string_io, 'remote/' }.should raise_error(ArgumentError)
|
594
|
+
end
|
595
|
+
end
|
574
596
|
end
|
575
597
|
|
576
598
|
describe "request" do
|
@@ -621,7 +643,8 @@ describe Dropbox::API do
|
|
621
643
|
|
622
644
|
it "should send the request" do
|
623
645
|
uri = URI.parse(Dropbox::ALTERNATE_HOSTS['files'])
|
624
|
-
Net::HTTP
|
646
|
+
@http = mock('Net::HTTP', :request => @response)
|
647
|
+
Net::HTTP.stub!(:new).and_return(@http)
|
625
648
|
|
626
649
|
@session.upload __FILE__, 'test'
|
627
650
|
end
|
@@ -631,7 +654,8 @@ describe Dropbox::API do
|
|
631
654
|
@session.authorize
|
632
655
|
|
633
656
|
uri = URI.parse(Dropbox::ALTERNATE_SSL_HOSTS['files'])
|
634
|
-
Net::HTTP
|
657
|
+
@http = mock('Net::HTTP', :request => @response)
|
658
|
+
Net::HTTP.stub!(:new).and_return(@http)
|
635
659
|
|
636
660
|
@session.upload __FILE__, 'test'
|
637
661
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
+
Bundler.require :default, :test
|
2
|
+
|
1
3
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
4
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
3
|
-
|
4
|
-
require 'dropbox
|
5
|
-
require 'spec'
|
6
|
-
require 'spec/autorun'
|
5
|
+
|
6
|
+
require 'dropbox'
|
7
7
|
|
8
8
|
module ExternalKeysFileHelper
|
9
9
|
def read_keys_file
|
@@ -11,7 +11,7 @@ module ExternalKeysFileHelper
|
|
11
11
|
raise "Please add a keys.json file to the project directory containing your Dropbox API key and secret. See keys.json.example to get started."
|
12
12
|
end
|
13
13
|
|
14
|
-
keys_file_contents = open("keys.json", "r").read
|
14
|
+
keys_file_contents = open("keys.json", "r").read
|
15
15
|
data = JSON.parse(keys_file_contents)
|
16
16
|
unless %w( key secret email password ).all? { |key| data.include? key }
|
17
17
|
raise "Your keys.json file does contain all the required information. See keys.json.example for more help."
|
@@ -21,6 +21,6 @@ module ExternalKeysFileHelper
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
RSpec.configure do |config|
|
25
25
|
config.include(ExternalKeysFileHelper)
|
26
26
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
-
- 1
|
8
7
|
- 2
|
9
|
-
|
8
|
+
- 0
|
9
|
+
version: 1.2.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tim Morgan
|
@@ -14,28 +14,12 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-31 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
name: rspec
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 1
|
30
|
-
- 2
|
31
|
-
- 9
|
32
|
-
version: 1.2.9
|
33
|
-
type: :development
|
34
|
-
version_requirements: *id001
|
35
20
|
- !ruby/object:Gem::Dependency
|
36
21
|
name: oauth
|
37
|
-
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
39
23
|
none: false
|
40
24
|
requirements:
|
41
25
|
- - ">="
|
@@ -46,11 +30,11 @@ dependencies:
|
|
46
30
|
- 6
|
47
31
|
version: 0.3.6
|
48
32
|
type: :runtime
|
49
|
-
|
33
|
+
prerelease: false
|
34
|
+
version_requirements: *id001
|
50
35
|
- !ruby/object:Gem::Dependency
|
51
36
|
name: json
|
52
|
-
|
53
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
54
38
|
none: false
|
55
39
|
requirements:
|
56
40
|
- - ">="
|
@@ -61,11 +45,11 @@ dependencies:
|
|
61
45
|
- 0
|
62
46
|
version: 1.2.0
|
63
47
|
type: :runtime
|
64
|
-
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: *id002
|
65
50
|
- !ruby/object:Gem::Dependency
|
66
51
|
name: multipart-post
|
67
|
-
|
68
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
69
53
|
none: false
|
70
54
|
requirements:
|
71
55
|
- - ">="
|
@@ -75,11 +59,11 @@ dependencies:
|
|
75
59
|
- 0
|
76
60
|
version: "1.0"
|
77
61
|
type: :runtime
|
78
|
-
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: *id003
|
79
64
|
- !ruby/object:Gem::Dependency
|
80
65
|
name: mechanize
|
81
|
-
|
82
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
83
67
|
none: false
|
84
68
|
requirements:
|
85
69
|
- - ">="
|
@@ -90,7 +74,8 @@ dependencies:
|
|
90
74
|
- 0
|
91
75
|
version: 1.0.0
|
92
76
|
type: :runtime
|
93
|
-
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: *id004
|
94
79
|
description: An easy-to-use client library for the official Dropbox API.
|
95
80
|
email: dropbox@timothymorgan.info
|
96
81
|
executables: []
|
@@ -104,7 +89,10 @@ extra_rdoc_files:
|
|
104
89
|
files:
|
105
90
|
- .document
|
106
91
|
- .gitignore
|
92
|
+
- .rspec
|
107
93
|
- ChangeLog
|
94
|
+
- Gemfile
|
95
|
+
- Gemfile.lock
|
108
96
|
- LICENSE
|
109
97
|
- README.rdoc
|
110
98
|
- Rakefile
|
@@ -130,7 +118,6 @@ files:
|
|
130
118
|
- spec/dropbox/revision_spec.rb
|
131
119
|
- spec/dropbox/session_spec.rb
|
132
120
|
- spec/dropbox_spec.rb
|
133
|
-
- spec/spec.opts
|
134
121
|
- spec/spec_helper.rb
|
135
122
|
has_rdoc: true
|
136
123
|
homepage: http://github.com/RISCfuture/dropbox
|
@@ -146,6 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
133
|
requirements:
|
147
134
|
- - ">="
|
148
135
|
- !ruby/object:Gem::Version
|
136
|
+
hash: -1468643052692495920
|
149
137
|
segments:
|
150
138
|
- 0
|
151
139
|
version: "0"
|