ruby-box 1.0.6 → 1.1.0
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/ruby-box.gemspec +4 -3
- data/spec/client_spec.rb +1 -0
- data/spec/file_spec.rb +1 -0
- data/spec/folder_spec.rb +1 -0
- data/spec/integration_spec.rb +2 -23
- data/spec/spec_helper.rb +3 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NTI2NDAyOTY0NGNlZmE0MjdjMGI0MTEyZmI0MjgwYmYyODY0YzFhNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MDExZTg4NTcyZjYyNWUyMDk0MDM1ZDk4NzQ2MmVhMDZkNDBlYWQ5Yg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDYwZTM1ZjYwNWNlY2JjMDc2MWEwZDlhNzBlY2MwOGFlZThhNmE2MmNhMTg1
|
10
|
+
N2M4YmY0YTVmYjZhMTk1ZDNiMDNlMjIyZGNiM2VjMDBlYzBmZDJiYTBhMzAw
|
11
|
+
MjcxMjljYmUzY2FmNzQwNWY1ZTc5YTBjNzE4ZTk3N2U2YzgyNmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjA2M2NkY2Y4Nzc3Yzk3NTRlMjJjZGU3YTVlZmRjMDA0NjFlMWFmNDQ1ZDc3
|
14
|
+
ZDk0OWJlYjZjYTVkZjZmNTIwNDZlMzU2ZTAxNzY4OGQ5M2YwMWU2NTQwOTJm
|
15
|
+
ODExOGJiYWJiYjhjNWYyMGJjZTAyMjJmMzZhOGFkMzY4N2FlOTY=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
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.1.0"
|
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-19"
|
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 = [
|
@@ -41,7 +41,8 @@ Gem::Specification.new do |s|
|
|
41
41
|
"spec/folder_spec.rb",
|
42
42
|
"spec/helper/account.example",
|
43
43
|
"spec/helper/account.rb",
|
44
|
-
"spec/integration_spec.rb"
|
44
|
+
"spec/integration_spec.rb",
|
45
|
+
"spec/spec_helper.rb"
|
45
46
|
]
|
46
47
|
s.homepage = "http://github.com/attachmentsme/ruby-box"
|
47
48
|
s.licenses = ["MIT"]
|
data/spec/client_spec.rb
CHANGED
data/spec/file_spec.rb
CHANGED
data/spec/folder_spec.rb
CHANGED
data/spec/integration_spec.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
#encoding: UTF-8
|
2
2
|
|
3
|
+
require 'spec_helper'
|
3
4
|
require 'helper/account'
|
4
5
|
require 'ruby-box'
|
5
6
|
require 'webmock/rspec'
|
6
7
|
|
7
|
-
describe RubyBox do
|
8
|
+
describe RubyBox, :skip => true do
|
8
9
|
before do
|
9
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
10
|
-
|
11
10
|
WebMock.allow_net_connect!
|
12
11
|
|
13
12
|
@session = RubyBox::Session.new({
|
@@ -19,8 +18,6 @@ describe RubyBox do
|
|
19
18
|
end
|
20
19
|
|
21
20
|
it "raises an AuthError if not client auth fails" do
|
22
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
23
|
-
|
24
21
|
session = RubyBox::Session.new({
|
25
22
|
api_key: 'bad-key',
|
26
23
|
auth_token: 'bad-token'
|
@@ -32,13 +29,11 @@ describe RubyBox do
|
|
32
29
|
end
|
33
30
|
|
34
31
|
it "raises a RequestError if a badly formed request detected by the server" do
|
35
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
36
32
|
stub_request(:get, "https://api.box.com/2.0/folders/0").to_return(:status => 401, :body => '{"type": "error", "status": 401, "message": "baddd req"}', :headers => {})
|
37
33
|
lambda {@client.root_folder}.should raise_error( RubyBox::AuthError )
|
38
34
|
end
|
39
35
|
|
40
36
|
it "raises a ServerError if the server raises a 500 error" do
|
41
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
42
37
|
stub_request(:get, "https://api.box.com/2.0/folders/0").to_return(:status => 503, :body => '{"type": "error", "status": 503, "message": "We messed up! - Box.com"}', :headers => {})
|
43
38
|
lambda {@client.root_folder}.should raise_error( RubyBox::ServerError )
|
44
39
|
end
|
@@ -46,7 +41,6 @@ describe RubyBox do
|
|
46
41
|
describe RubyBox::Folder do
|
47
42
|
describe '#root_folder' do
|
48
43
|
it "#items returns a lits of items in the root folder" do
|
49
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
50
44
|
items = @client.root_folder.items.to_a
|
51
45
|
items.count.should == 6
|
52
46
|
items.any? do |item|
|
@@ -57,7 +51,6 @@ describe RubyBox do
|
|
57
51
|
end
|
58
52
|
|
59
53
|
it "returns list of items in the folder id passed in" do
|
60
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
61
54
|
folder = RubyBox::Folder.new(@session, {'id' => '318810303'})
|
62
55
|
items = folder.items.to_a
|
63
56
|
items.count.should == 2
|
@@ -71,7 +64,6 @@ describe RubyBox do
|
|
71
64
|
|
72
65
|
describe '#file' do
|
73
66
|
it "finds the id of a file" do
|
74
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
75
67
|
folder = RubyBox::Folder.new(@session, {'id' => '318810303'})
|
76
68
|
file = folder.files( '2513582219_03fb9b67db_b.jpg' ).first
|
77
69
|
file.id.should == "2550686921"
|
@@ -80,8 +72,6 @@ describe RubyBox do
|
|
80
72
|
|
81
73
|
describe '#create' do
|
82
74
|
it "creates a folder" do
|
83
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
84
|
-
|
85
75
|
folder = @client.folder('/ruby-box_gem_testing')
|
86
76
|
subfolder = folder.create_subfolder( 'new_folder_created' )
|
87
77
|
subfolder.id.should_not == nil
|
@@ -90,8 +80,6 @@ describe RubyBox do
|
|
90
80
|
end
|
91
81
|
|
92
82
|
it "creates a folder with special chars in the name" do
|
93
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
94
|
-
|
95
83
|
folder = @client.folder('/ruby-box_gem_testing')
|
96
84
|
subfolder = folder.create_subfolder( '!@#$%^&$$()' )
|
97
85
|
subfolder.id.should_not == nil
|
@@ -106,8 +94,6 @@ describe RubyBox do
|
|
106
94
|
|
107
95
|
describe '#put_data' do
|
108
96
|
it "should update an existing file" do
|
109
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
110
|
-
|
111
97
|
utf8_file_name = '遠志教授.jpg'
|
112
98
|
fdata = File.open( 'spec/fixtures/' + utf8_file_name, 'rb' )
|
113
99
|
response = @client.upload_data('/ruby-box_gem_testing/cool stuff/遠志教授.jpg', fdata)
|
@@ -119,7 +105,6 @@ describe RubyBox do
|
|
119
105
|
end
|
120
106
|
|
121
107
|
it "should upload a new file" do
|
122
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
123
108
|
utf8_file_name = '遠志教授.jpg'
|
124
109
|
file = @client.upload_file('spec/fixtures/' + utf8_file_name, '/ruby-box_gem_testing/cool stuff/')
|
125
110
|
file.name.should == '遠志教授.jpg'
|
@@ -129,7 +114,6 @@ describe RubyBox do
|
|
129
114
|
|
130
115
|
describe '#create_folder' do
|
131
116
|
it "creates a path that doesnt exist" do
|
132
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
133
117
|
folder = @client.create_folder('/ruby-box_gem_testing/cool stuff/екузц/path1/path2')
|
134
118
|
folder.id.should_not == nil
|
135
119
|
folder.delete if folder
|
@@ -138,7 +122,6 @@ describe RubyBox do
|
|
138
122
|
|
139
123
|
describe '#get_file_info' do
|
140
124
|
it "returns meta information for a file" do
|
141
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
142
125
|
file = @client.file( '/ruby-box_gem_testing/cool stuff/кузнецкий_105_а_№2.test' )
|
143
126
|
file.size.should == 14
|
144
127
|
end
|
@@ -146,13 +129,11 @@ describe RubyBox do
|
|
146
129
|
|
147
130
|
describe '#stream' do
|
148
131
|
it "should download file contents" do
|
149
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
150
132
|
stream = @client.stream( '/ruby-box_gem_testing/cool stuff/кузнецкий_105_а_№2.test' )
|
151
133
|
stream.read.should eq "Test more data"
|
152
134
|
end
|
153
135
|
|
154
136
|
it "should execute content_length_proc lambda with filesize" do
|
155
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
156
137
|
stream = @client.stream(
|
157
138
|
'/ruby-box_gem_testing/cool stuff/кузнецкий_105_а_№2.test',
|
158
139
|
:content_length_proc => lambda {|filesize|
|
@@ -165,13 +146,11 @@ describe RubyBox do
|
|
165
146
|
|
166
147
|
describe '#download' do
|
167
148
|
it "finds the id of a file" do
|
168
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
169
149
|
data = @client.download( '/ruby-box_gem_testing/cool stuff/кузнецкий_105_а_№2.test' )
|
170
150
|
data.should eq "Test more data"
|
171
151
|
end
|
172
152
|
|
173
153
|
it "returns nil for a nonexistent file" do
|
174
|
-
next unless ACCOUNT['api_key'] # skip these tests if accout.yml does not exist.
|
175
154
|
data = @client.download( '/ruby-box_gem_testing/doesntexist' )
|
176
155
|
data.should eq nil
|
177
156
|
end
|
data/spec/spec_helper.rb
ADDED
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.1.0
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multipart-post
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- spec/helper/account.example
|
128
128
|
- spec/helper/account.rb
|
129
129
|
- spec/integration_spec.rb
|
130
|
+
- spec/spec_helper.rb
|
130
131
|
homepage: http://github.com/attachmentsme/ruby-box
|
131
132
|
licenses:
|
132
133
|
- MIT
|