dropbox-api 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,10 @@ module Dropbox
25
25
  end
26
26
 
27
27
  def copy_from_copy_ref(copy_ref, to, options = {})
28
- raw.copy({ :from_copy_ref => copy_ref, :to_path => to }.merge(options))
28
+ raw.copy({
29
+ :from_copy_ref => copy_ref,
30
+ :to_path => to
31
+ }.merge(options))
29
32
  end
30
33
 
31
34
  end
@@ -23,6 +23,7 @@ module Dropbox
23
23
  def request(endpoint, method, action, data = {})
24
24
  action.sub! ':root', data.delete(:root) if action.match ':root'
25
25
  action.sub! ':path', Dropbox::API::Util.escape(data.delete(:path)) if action.match ':path'
26
+ action = Dropbox::API::Util.remove_double_slashes(action)
26
27
  connection.send(method, endpoint, action, data)
27
28
  end
28
29
 
@@ -15,6 +15,10 @@ module Dropbox
15
15
  data.inject([]) { |memo, entry| memo.push(entry.join('=')); memo }.join('&')
16
16
  end
17
17
 
18
+ def remove_double_slashes(path)
19
+ path.gsub('//', '/')
20
+ end
21
+
18
22
  end
19
23
 
20
24
  end
@@ -1,5 +1,5 @@
1
1
  module Dropbox
2
2
  module API
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
@@ -116,12 +116,24 @@ describe Dropbox::API::Client do
116
116
 
117
117
  describe "#search" do
118
118
 
119
- it "finds a file" do
119
+ let(:term) { "searchable-test-#{Dropbox::Spec.namespace}" }
120
+
121
+ before do
120
122
  filename = "#{Dropbox::Spec.test_dir}/searchable-test-#{Dropbox::Spec.namespace}.txt"
121
123
  @client.upload filename, "Some file"
122
- response = @client.search "searchable-test-#{Dropbox::Spec.namespace}", :path => "#{Dropbox::Spec.test_dir}"
123
- response.size.should == 1
124
- response.first.class.should == Dropbox::API::File
124
+ end
125
+
126
+ after do
127
+ @response.size.should == 1
128
+ @response.first.class.should == Dropbox::API::File
129
+ end
130
+
131
+ it "finds a file" do
132
+ @response = @client.search term, :path => "#{Dropbox::Spec.test_dir}"
133
+ end
134
+
135
+ it "works if leading slash is present in path" do
136
+ @response = @client.search term, :path => "/#{Dropbox::Spec.test_dir}"
125
137
  end
126
138
 
127
139
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dropbox-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: