ruby-box 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/VERSION +1 -1
- data/lib/ruby-box/client.rb +8 -6
- data/ruby-box.gemspec +2 -2
- data/spec/client_spec.rb +24 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTM0YjAzZDU5NjZiZDQ2NjJmZTM1ZDcxYWUwNThhNGY3MGUwMTRhNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzliNmI4NTBjNjU0YzY0ZDQ4YTk0NDYzMjI3OTZkNTVlNGZlZjJmMw==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjBjMWY0YzE5MzE3ZGY2ZGQ0MzNmZDYxZDQ5MGM0OTk3N2M1MGEwYWY4Zjg4
|
10
|
+
Y2UzYTYxNmU0OTUwMTUwZmYwMTE4ZmNlNWZlMzJjZmIwZWFjMGJhY2E2ZTBl
|
11
|
+
ZDE1MmM0NWRhOGY3OGQ3ZmJjMzY1NWFhNjg1NzVhMzA4NTViNmI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTUyYjIwM2EwZmY2NzgzZjQ0ZDk1OGRhY2JlYmNjNDIyNzQ3MDExYmJjZTNh
|
14
|
+
NWVhMmYyMzMyMTI2YzY5ODI4ZDM3NjljMzc5NGIxYzlhMzc0MTdhNDIxNjhk
|
15
|
+
OWUyNjQ0ZTgzYTM4NTBlNzY2ZDY3ZDllNTNmNjJmYmI4NDg2Yzg=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.6
|
data/lib/ruby-box/client.rb
CHANGED
@@ -55,13 +55,15 @@ module RubyBox
|
|
55
55
|
folder = root_folder
|
56
56
|
folder_names = split_path(path)
|
57
57
|
folder_names.each do |folder_name|
|
58
|
-
new_folder = folder.folders(folder_name).first
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
new_folder = folder.folders(folder_name).first
|
59
|
+
if !new_folder
|
60
|
+
begin
|
61
|
+
new_folder = folder.create_subfolder(folder_name)
|
62
|
+
rescue RubyBox::ItemNameInUse => e
|
63
|
+
new_folder = folder.folders(folder_name).first
|
64
|
+
end
|
63
65
|
end
|
64
|
-
folder = new_folder
|
66
|
+
folder = new_folder
|
65
67
|
end
|
66
68
|
folder
|
67
69
|
end
|
data/ruby-box.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ruby-box"
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Attachments.me"]
|
12
|
-
s.date = "2013-04-
|
12
|
+
s.date = "2013-04-02"
|
13
13
|
s.description = "ruby gem for box.com 2.0 api"
|
14
14
|
s.email = "ben@attachments.me"
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/client_spec.rb
CHANGED
@@ -25,4 +25,28 @@ describe RubyBox::Client do
|
|
25
25
|
client.split_path('foo/bar/').should == ['foo', 'bar']
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
describe '#create_folder' do
|
30
|
+
it 'doesnt call folder.create_folder if the folder exists' do
|
31
|
+
client = RubyBox::Client.new(@session)
|
32
|
+
mock_root_folder = mock( Object )
|
33
|
+
test_folder = mock( Object )
|
34
|
+
mock_root_folder.should_receive(:folders).and_return([test_folder])
|
35
|
+
mock_root_folder.should_not_receive(:create_subfolder)
|
36
|
+
client.should_receive(:root_folder).and_return(mock_root_folder)
|
37
|
+
result = client.create_folder( '/test0')
|
38
|
+
result.should == test_folder
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'calls folder.create_folder if the folder does not exist' do
|
42
|
+
client = RubyBox::Client.new(@session)
|
43
|
+
mock_root_folder = mock( Object )
|
44
|
+
test_folder = mock( Object )
|
45
|
+
mock_root_folder.should_receive(:folders).and_return([])
|
46
|
+
mock_root_folder.should_receive(:create_subfolder).and_return(test_folder)
|
47
|
+
client.should_receive(:root_folder).and_return(mock_root_folder)
|
48
|
+
result = client.create_folder( '/test0')
|
49
|
+
result.should == test_folder
|
50
|
+
end
|
51
|
+
end
|
28
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-box
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Attachments.me
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multipart-post
|